Most voted ".net" questions
The Microsoft . NET is a set of libraries and functions that are part of the Basic Class Library (BCL), such as user interface functions, data access, connectivity, cryptography, web development, mathematical algorithms, and network communication.
Learn more…2,689 questions
Sort by count of
-
7
votes1
answer1248
viewsWhat is Microsoft’s MAUI?
I read that Microsoft’s MAUI is an evolution of Xamarin.Forms. I would like to know: What changes from the old version to this? What platforms are supported? How the migration between Xamarin.Forms…
-
7
votes4
answers1423
viewsHow to build custom queries using Entity Framework?
I have an SQL Server database that is accessed via ORM Entity Framework Core, where access to a collection of products, these products are filtered through a DTO that has the terms of the search,…
-
7
votes2
answers173
viewsSearch range of numbers (string type) with Expression Lambda?
I have this data model and I don’t know how to do the instruction lambda: public class CidadeAbrangencia { [Key] public int CidadeAbrangencia_Id { get; set; } public string CEPInicial { get; set; }…
-
7
votes1
answer177
viewsCreate a program that draws 6 numbers and shows how many times it was drawn
I’m making a program that draws 6 numbers (1 to 6) 1 million times and in the end shows how many times was drawn, but I have a doubt in the code, I’m optimizing in vectors not to use if, but in the…
-
7
votes1
answer116
viewsAre the new self-contained . NET executables really native?
In that question here, was discussed about whether there is a need to install . NET 5 (or .NET Core 3) on the machine to run compiled executables, and the answer is: No, the . NET 5 is not…
-
7
votes2
answers138
viewsWhat is the Enumerable Zip in . NET?
I was making a code to combine two lists, and looking to improve discovered the method Zip of the interface IEnumerable. At first I thought it was some algorithm to "zip" a list/array/etc., but I…
-
7
votes1
answer113
viewsIs there a difference between using discard or ignoring the value returned by a method?
I have a method similar to the below: public bool FazerAlgoERetornarSeSucesso() => true; And at some point, I need to call this method, but I don’t care about the result. Normally I would do…
-
6
votes1
answer3199
viewsWhat does <T> mean in . NET?
I’m working on a project and I saw a lot of code like this public class ExemploCollection<T> { ... } And I don’t understand what this <T> means. What’s the name of it, what am I looking…
-
6
votes1
answer681
viewsLetter after a number, what is this called?
What’s the name of it? double d1 = 0d; decimal d2 = 0L; float d3 = 0f; And where can I find a reference of the characters I can use? If I want to make one cast of 0 for short, there is some letter…
-
6
votes1
answer674
viewsHow to define the culture in a WCF Webservice?
I have a plea WCF rotating in the IIS where the server language/culture is all defined in English. There is no possibility for me to change the server settings so that I could change the culture or…
-
6
votes3
answers838
viewsCustom tool Warning: Cannot import wsdl:portType
I can’t use the ServiceReference after successfully importing. After performing the import, write the class and use your methods in the build occur the Warnings: Warning 1 Custom tool warning:…
-
6
votes1
answer857
viewsWhy doesn’t Visual Studio 2013 let you use version 4 of the Entity Framework?
I don’t know why, but whenever I try to update Object Model from an old project we have, Visual Studio 2013, asks if we want to keep version 4 of EF, but even marking the right version it updates…
-
6
votes2
answers476
viewsVersioning scheme
In . NET, the assemblies generated have four version numbers. I’ve heard a lot about larger version and smaller version (major version and minor version), and that those would be the first two…
-
6
votes2
answers2883
views -
6
votes1
answer237
viewsHow to convert a value in UNIX type Timestamp to Datetime?
How to convert a value to type UNIX timestamp (seconds since 1970), example 1396148400, in a DateTime?
-
6
votes4
answers6284
viewsHow does an empty constructor work?
Definition: Creating an empty constructor attributes if not set will be set to the default value of guy, example: int default value is zero. Context: Use a structure that returns entities from the…
-
6
votes1
answer363
viewsDetect Caps Lock C#
I made an application to detect the state of caps lock in C#, but I found a problem, when the application loses focus events can no longer be triggered causing notifications to no longer be…
-
6
votes1
answer5290
viewsMethod that returns a class
I am trying to create a method that takes a string and returns an instance of the class with the name passed, example: "Calculator", will return me an instance of the class "Calculator" (If it…
-
6
votes2
answers895
viewsRemove "/" from a Datetime.Toshortdatestring();
I am implementing a program using C# with . net 3.5 I have the following code: StringBuilder sb = new StringBuilder(); sb.Append(caminhoSalvarCobranca); sb.Append(@"\Boleto ");…
-
6
votes4
answers438
views"Clean" way to modify the "Visible" attribute of a Picturebox
I have 5 background images for my application and that will be visible to the user’s taste. What is the simplest way (clean code) to get the user to choose? private void…
-
6
votes3
answers905
viewsProblems with Double formatting
I have a method that gets values like string and performs the conversion to other types, my problem is that when converting an information to double It changes its precise value so that it doesn’t…
-
6
votes3
answers1504
viewsCopy file with progress
How I use the C function# File.Copy(string path); to copy a file by incrementing a value in a Progressbar?
-
6
votes4
answers3435
views -
6
votes4
answers1593
viewsChanging connectionStrings from the app.config physically in Runtime
In my app.config I have the following lines of code: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> </configSections> <connectionStrings>…
-
6
votes1
answer1941
viewsChange the . NET 4.5 project to 4.5.2, how to do it?
I installed . NET 4.5.2 on the machine, restarted Windows 7 and, after opening the project, went to Debug > Projeto.Properties > Application and tried to change the version by combo Target…
-
6
votes2
answers1419
views -
6
votes2
answers112
viewsCheck which processes are connected to the internet
It is possible to check which processes are connected to the internet and what is their destination?
-
6
votes2
answers4042
viewsGet property values of a class
I have the following codes: private PropertyInfo[] ObterPropriedades(Type classe) { PropertyInfo[] properties = classe.GetProperties(); return properties; } private string[]…
-
6
votes2
answers233
viewsIs there any way to handle all Exceptions of the software?
I’m creating a DLL for use in various projects of mine. I created a method that captures Source, Message and other variables that I defined, assembles an email and sends them to myself. (a kind of…
-
6
votes4
answers4566
viewsHow do I update my data in the table using the Entityframework?
var contactado = ContactadoRepositorio.ObterListaContactadoPorCodigo(procedimentoVM.CodContactadoPessoa); //obtenho o contactado pelo id obtido; foreach (var c in contactado) { var contactadoPessoa…
-
6
votes3
answers325
viewsPrevent the system from locking during a batch e-mail
I am developing a system that sends mail in batches to customers, but if the user who is operating the system click on any part of the window during the process, it appears that the system is not…
-
6
votes2
answers599
viewsStatic classes and classes with static methods
When I declare a class static, I am obliged to write my static methods and this class can never be instantiated. Now, I have a common class and I create my methods within it all static. Well, I do…
-
6
votes2
answers8444
viewsPass generic list as parameter
You can pass a generic list by parameter? Ex: I have one List<Pessoa> and a List<object>. and I have my method: public void FaçaAlgo(List<T> lista) { } How can I make my method…
-
6
votes2
answers328
viewsShow white space for Null value in Views
When I send some value null for my view, and Razor tries to render the value, is returned a Exception. There is a way when the view receive a value null, render this as a blank space without having…
-
6
votes1
answer183
viewsCreating Properties, Summary and Custom Colors for Methods and Types
Is there a way or attribute that puts in a Class, Method, Structure or anything else that changes its color? Example of the function CType: Notice that she is colorful, and her arguments instead of…
-
6
votes1
answer308
viewsWhat is the use of indexers?
I was watching and the Csharp has indexes. Second definition on the website microsoft: Indexers allow instances of a class or structure are indexed only as vectors. Examples: internal class…
-
6
votes2
answers1307
viewsWhat does a "Thread Safety" class mean?
According to the MSDN to Webapp Class (Microsoft.Owin.Hosting) is Thread Safety. What exactly does that mean? This class specifically has a method Start that: Start a web app.... Every request to…
-
6
votes0
answers151
viewsHow to avoid Paper Feed
Hello, I am using a Engeworks non tax thermal printer to print payment vouchers, I am using the Generic Text Only driver. The problem is that she prints the vouchers as if they were whole pages and…
-
6
votes2
answers338
viewsComments on regular expressions?
REGEX is a very complicated language and not easy to read, but is there any way to describe what that little letter does? Example: Nessa regex: \{.*?[^\}]+\} will capture everything you have in a…
-
6
votes1
answer469
viewsHow to run a web application on IIS without hosting the source code on the machine?
I have developed a web application (Asp.net, c#, javascript , etc) for a client. The idea is to mature this application, and turn it into a product. The question is, how can I run my web application…
-
6
votes1
answer407
viewsIs it possible to show exception message in en-BR?
I would like my exception message to be shown in English, someone would know how? catch (Exception ex) { Debug.Writeline(ex.Message); }
-
6
votes1
answer1790
viewsDisable dates before the current day in Datetimepicker?
It is possible in the DateTimePicker, disable the days before the current day?
-
6
votes2
answers901
viewsExtract file . ZIP with accent on name
I’m using the lib System.IO.Compression.ZipFile to unzip files .zip and came across a big problem while trying to extract files that have accents in the name. If I try to extract with encoding…
-
6
votes4
answers1247
viewsFunction within another
In Javascript, I can structure my code well by placing auxiliary functions inside other functions. For example: I get something similar in C#? If not, how do you not leave the auxiliary functions…
-
6
votes3
answers13362
viewsHow to remove whitespace from a text?
I was trying to get blanks out of a string, but the .Trim() does not work, it displays the white spaces yet: var teste = texto.Trim(); txtConteudo.Text = teste; For example, if he receives: "text ",…
-
6
votes1
answer742
viewsSelect Gridview line with checkbox
function Selecionar(elemento,cordefundo) { var Inputs = elemento.getElementsByTagName("input"); var cor = elemento.style.backgroundColor; //manter a cor default do elemento for(var i = 0; i <…
-
6
votes1
answer858
viewsWhat are controller actions?
In that reply the Gypsy says This (example) is good when you have several Actions in the Controller What are the Actions of a Controller? Note: I would like some example of code as well, defining a…
-
6
votes1
answer187
viewsDownload FTP using c#
I am trying to download an FTP server. The problem is this: I need a way to partition the file I am downloading. So that it is downloaded part by part and not complete at once. Doing asynchronously…
-
6
votes2
answers5645
viewsRemove special characters and spaces from a string?
I have a problem, in an app I’m picking up the contacts from the phone book, but I want to do a treatment on the numbers of the contacts that can come like this: (99) 9999-9999 9999-9999 9999 9999…
-
6
votes1
answer71
viewsWhy can’t I display Messageboxbuttons if it’s not a string?
'Cause I’m having trouble showing off MessageBoxButtons if it is not a string? static void Main() { string texto = "Minha primeira MessageBox"; MessageBoxButtons botao = MessageBoxButtons.OKCancel;…