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
-
79
votes2
answers11641
viewsWhat is Reflection. Why is it useful?
It is recommended to use in projects? How to use? In what situations Reflection can be used?
-
76
votes3
answers5608
viewsWhat does "immutable" really mean?
In that question I did about value types and reference types in C#, it was quoted in the accepted answer that instances of structs must be immutable objects. Reading on wikipedia confirmed that an…
-
74
votes5
answers2194
viewsExceptions consume a lot of processing. Truth or legend?
I’ve seen shows like this : if(!clienteExiste(1)) { return "Cliente não existe."; } and others like that if(!clienteExiste(1)) { throw new Exception("Cliente não existe."); } The second code will…
-
71
votes8
answers49747
viewsHow do I remove accents in a string?
I have a string áéíóú That I want to convert to aeiou How do I remove accents? Need to save to database as a URL.
-
68
votes1
answer19312
views -
68
votes2
answers16758
views -
59
votes6
answers10591
views -
57
votes5
answers7848
viewsWhat is the difference of string vs string?
I wonder what the real difference is between String (capital letters) and string (s tiny). Apparently the two have the same goals, but which is "best" to use?
-
55
votes4
answers9003
viewsBest way to deal with Exceptions
During my work I learned a way to deal with Exceptions, but I don’t know if it’s very good. Here’s an example of the code: class Program { private static void Main(string[] args) { try { Foo(); }…
-
54
votes4
answers17728
viewsWhat is a scaffold?
I started studying ASP.NET MVC and came across the term scaffold, but I didn’t understand it very well, so: What is scaffold? What is its use within ASP.NET MVC?…
asp.net-mvc .net terminology software-engineering scaffoldasked 8 years, 10 months ago Marco Souza 12,304 -
51
votes2
answers4996
viewsMemory allocation in C# - Value types and reference types
In C# there is a difference between the form that memory is allocated by the CLR for reference types (classes) and value types (structures). The difference, from what I’ve always heard, would be…
-
50
votes1
answer5366
viewsWhat is the meaning of the operator "?"
I was looking at some codes and I came across the operator ??: static int? GetNullableInt() { return null; } int y = x ?? -1; What is the difference between the first code and the second?…
-
49
votes1
answer13752
viewsDifference between Icollection, Ilist and List?
What’s the difference between ICollection, IList and List? When I should use each one specifically?
-
49
votes1
answer2641
viewsWhat does the symbol "$" mean before a string?
Viewing a code here in Sopt, I noticed the use of the symbol "$" and I was left with doubt about its use. What is the symbol "$" before a string? What good is he? Why use it? Example using static…
-
48
votes3
answers11626
viewsWhat’s the use of the reserved word "Yield"?
What is the use of the keyword (reserved) yield? When and where it is used?
-
42
votes3
answers5198
viewsDifference between the use of typeof and is
In C# when I need to check if a variable is of a certain type, I usually use the operator is: if(qualquerVariavel is int) Console.Write("A variável é int"); I know it is also possible to check the…
-
34
votes7
answers14277
viewsWhat can C++ do that C# can’t?
Being a programmer . Net but with an old passion for C++ (which has grown since C++11), I was with this curiosity. I know . Net can be "extended" with C++/CLI, but I would like to know what C# pure…
-
34
votes1
answer1550
viewsWhat is . Native Net?
These days I saw our colleague Maniero commenting on the existence of .NET Native in a response on C# and C++. I saw that Microsoft announced in April 2014 the preview of . NET Native. And searching…
-
31
votes4
answers28968
viewsWhat is the most appropriate way to concatenate strings?
There are different methods for concatenating strings, such as Concatenating with the operator "abc" + str Formatting String.Format("abc{0}", str); Using the Stringbuilder new…
-
31
votes1
answer5828
viewsDifference between Task and Thread
I need to create an executable c# and the question was: Do with thread or do with task? In practice there is some difference between using Task and the "traditional" multi-thread?? It is true that a…
-
30
votes3
answers2867
viewsCapitalizing on C#names
I have in my application given names in capital letters, for example: "JOSÉ DA SILVA". I would like to format as follows: "José da Silva". How to do?
-
30
votes2
answers5203
viewsMethods and properties in C# - advantages and disadvantages
In C# we have properties with getters and setters, which facilitates the insertion and reading of data in an object when some logic should be performed. In other languages, such as Java these tasks…
-
29
votes2
answers12489
views -
29
votes1
answer1530
viewsProperty Vs variables
I’ve always used properties in C# this way: public int Numero { get; set; } Today I asked myself, why do I use this get and set instead of a variable? Is there a difference? I only use it that way…
-
29
votes3
answers8073
viewsHow is the Global Unique Identifier (GUID) generated?
The Global Unique Identifier is generated so that no other will be generated equal, or will almost never have the same number. var unique = Guid.NewGuid().ToString(); Resultado:…
-
29
votes1
answer916
viewsWhy was . NET Core created?
I already know what it is and how to use it, but wanted to understand the goal of Microsoft for its creation. I know I had problems in the . NET Framework, but I don’t really understand why they…
-
28
votes3
answers1436
viewsHow does method management work in C#memory?
In C# there is a clear distinction between value types (structs) and reference types (classes), this distinction being basically the way in which the CLR manages instances of each type. Value type…
-
28
votes2
answers16435
viewsWhat are the out and ref parameters
What is the use of parameter types ref and out of a method in C#? What is the difference between the two? Some example of each one’s use.
-
28
votes2
answers12475
viewsWhat is the Antiforgerytoken?
What is the AntiForgeryToken and what it serves as in an ASP.NET MVC application?
-
27
votes6
answers8712
viewsHow and when to use Finally after a Try?
First I would like to know why in using the finally What are its advantages? It really only serves for when an exit occurs from within the scope of a block try-catch, as when some return or goto…
-
27
votes4
answers1698
viewsWhy use C#extension methods?
What I get with extension methods I don’t earn with inheritance? Simply using it as the same name is complicated, since it creates more confusion than anything else.
-
26
votes2
answers9155
viewsWhat is serialization? When to use? How to implement in C#?
[Serializable] public class Pessoa { public string Nome { get; set; } public string Cpf { get; set; } } There’s only one kind of serialization? What alternatives not to need serialize an object?…
-
26
votes2
answers1892
viewsWhat is the difference, in practice, between "" and String.Empty?
No. NET is noticeable in multiple ways to initialize a string with an empty value, called "quotation marks". Is there a right way to do this? And what would be the practical difference between…
-
26
votes5
answers1461
viewsIs it possible to code the size of the object in memory?
If I need to calculate the occupied space to make any decision has how to figure out the size that each type takes to check how much memory will be occupied if I allocate multiple instances of it?…
-
25
votes4
answers5615
viewsWhat is the difference in the use of the Equals method for the ==operator?
What is the difference in the use of the method Equals for the operator == in situations of comparison between (1) value types and (2) reference types?
-
25
votes1
answer2636
viewsWhat is the difference between const and readonly?
Read-only constants and fields cannot be modified, as can be seen in the documentation: const Constant fields and locations are not variable and cannot be modified. readonly When a field declaration…
-
24
votes3
answers4038
viewsWhat is the difference between using virtual property or not in EF?
I have my models public class Cliente { public int Id {get;set;} public string Nome {get;set;} } and public class Pedido { public int Id {get;set;} public int ClienteId {get;set;} public virtual…
-
24
votes2
answers4960
viewsWhat is the difference between "lambda" and LINQ? How to differentiate them in a sentence?
I often see terms like LINQ query and expressions lambda. Then the question arose, What I’m doing is a LINQ query, an expression lambda or both? Ex1: var query = Produtos.Where(p =>…
-
24
votes1
answer2966
viewsRoslyn Compiler - What is it, and why was it created?
What is the Roslyn compiler? This is the standard compiler of Visual Studio? Is it open source? Why did they do it? Only for C# or other languages?
c# .net vb.net compilation .net-compiler-platformasked 9 years, 5 months ago Guilherme de Jesus Santos 6,566 -
24
votes1
answer9723
viewsWhat is Tuple and when to use?
I saw the use in a site and I was left with the doubt of what is Tuple, and when should I use in my project?
-
23
votes5
answers573
viewsWhy are you wearing shorts?
The guy short corresponds to a 16-bit integer - it is literally syntactic sugar for type Int16. The current processors are all 64 bits, even on the most machines low-end. Some older machines still…
-
23
votes1
answer1280
viewsDifferences between declarative and imperative form of LINQ
What one way can do that the other can’t? There is a difference in performance? There’s one advantage over the other? Example: using System; using System.Collections.Generic; using System.Linq;…
-
23
votes3
answers2385
viewsHow important is the use of the word "this"?
What is the real use of using the reserved word this? As far as I can see it makes use or not, but I doubt its functionality.
-
23
votes3
answers478
viewsCan Garbage Collector language be used for games?
I started learning C# and even Java for interest in game development. But I know that many are developed with C++, mainly because I don’t have one Garbage Collector. Of course I know that several…
-
23
votes1
answer1547
viewsIs the . NET Framework dead?
In a small discussion with Maniero, in this answer, he said about the . NET Framework infrastructure: We’ll start talking about . NET or even BCL because the . NET Framework died. Why is . NET…
-
22
votes2
answers5714
viewsHow does it work and use the Stack in C#?
I came to a part of my program where I have to apply a stack (stack) and wanted someone to give me a simple explanation and an example. The program that I’m running right now is a notepad where you…
-
22
votes2
answers2225
viewsCompile string as code
There is how I compile a string within C#? Example: Console.WriteLine(\"Hello World\");. Like a eval javascript? 'Cause I had a project to load a code into a text file or something.…
-
22
votes3
answers10939
viewsHow does the C#lock work?
I was just looking at an article by MSDN, but it was not clear why to use this. class Account { decimal balance; private Object thisLock = new Object(); public void Withdraw(decimal amount) { lock…
-
22
votes3
answers57329
viewsFormat double with mile and decimal
I have the following value: 43239.110000000001 I used this command: txtSomatorio.Text = String.Format( "{0:#.#,##}", somatorio); I got this: 43239,11 How to do to display like this? 43.239,11…
-
22
votes3
answers7874
viewsASP.NET MVC or Webapi?
What is the advantage of using MVC and Webapi (using Visual Studio and C#)? I think that developing in MVC is easier to assemble a form with validations, because just put special attributes for this…