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
-
8
votes1
answer1061
viewsCapture the sound of a microphone in Windows via C#
How do I capture the audio the microphone receives in Windows with C#? I want to develop a software that receives the outside sound and based on that it changes the volume of my computer.
-
8
votes3
answers157
viewsHow does field initialization work in constructors?
In the C# documentation it is written: If a class does not have a constructor, a default constructor is Automatically generated and default values are used to initialize the Object Fields That is,…
-
8
votes1
answer1303
viewsWhat is and how does . NET Platform Standard work?
Recently I have studied the . NET Core and ASP.NET Core and one of the changes to the RC2 version that is to come, as far as I know, is called . NET Platform Standard. This standard is described in…
-
8
votes2
answers1332
viewsConvert string to Datetime in LINQ
I have a model where all fields are string. I want to convert to DateTime and Double For that I created a new model public class CPUStats { public DateTime Data { get; set; } public Double? Disco {…
-
8
votes2
answers881
viewsHow to avoid code repetition between classes?
To report on my application I have created several classes, and each class is responsible for a report, however, there is a repetition of a lot of code by those classes that I would like to avoid,…
-
8
votes2
answers268
viewsShoot event only once
I’m doing an interface in Visual Studio 2015, how do I hold an event just once? For example: private void textBox5_Click(object sender, EventArgs e) { textBox5.ForeColor = Color.Black;…
-
8
votes2
answers2113
viewsHow to create methods on an Enum?
I have an application in Java and am porting it to C#. I have a question regarding enum that seems to work differently from Java. After asking a question here on the site (Enumerations may contain…
-
8
votes2
answers653
viewsName collision between class and namespace
It’s wrong, bad practice or I might have problems with class like namespace? Example: namespace Cielo { public class Cielo { ... } } It’s been working, in some places it gets a little strange to…
-
8
votes2
answers321
viewsAre static classes shared by threads?
Static classes, methods and properties are shared between threads of the application? That is, if I modify the static property foo in ThreadA, and then modify the same static property foo in…
-
8
votes2
answers1094
viewsHow to declare a function within another function in C#?
In Delphi it is possible to declare function within the block of a given function, see this example done in Delphi: procedure TForm1.btnRunClick(Sender: TObject); begin mostrarNome('Carvalho'); end;…
-
8
votes0
answers101
viewsContent ID and Usage Policies with Youtube API
I’m trying to upload my videos on Youtube, with Usage Policy and Content Id Matching enabled. My project is on. NET with the Youtube API v3 library, but the library only allows the implementation…
-
8
votes1
answer305
viewsImpact of the Garbage Collector
The project here of the company is done in Windows Forms and we do not manage memory very well, because it is a legacy system that has several years running. Currently we are facing problems with…
-
8
votes2
answers291
views -
8
votes2
answers2458
viewsWhat is the purpose of Transactionscope blocks?
I have a code with several blocks TransactionScope and I didn’t quite understand its purpose. ModeloColDataContext dm = DataContextFactory.GetContext(usuario); { if (documento > 0) { using…
c# .net terminology software-engineering transactionsasked 7 years, 11 months ago Marco Souza 12,304 -
8
votes2
answers213
viewsDo I need to assign null to a variable after use?
There is a need to allocate null in the object after its use? In the example below just after using the list I have a method that takes a lot of time to run. I need to assign null to the list to…
-
8
votes2
answers107
viewsWhy are some string methods static?
I am learning C# after already working with other languages, I noticed that some methods need to be called by the class string.Concat("123","456") I usually use in other languages this way…
-
8
votes3
answers722
viewsInitialize private fields in the declaration or constructor?
I’m modeling a class that has a private list and an internal dependency on another object: public class Teste { private IList<string> Textos; private Teste2 Teste2; } I can initiate them in…
-
8
votes1
answer125
viewsWhat is the best way to get out of a C#app?
The most common way is to go out with a return in the Main(). But I saw that there is Environment.Exit() and the Application.Exit(). When should we use each?…
-
8
votes2
answers300
viewsWhy does . NET’s Garbage ollector have several generations?
I understand why there is a Garbage Collector, but I wanted to know the advantages of making it have several generations. It seems something much more complicated, it needs to be very advantageous.…
-
8
votes2
answers590
viewsWhat is the useshellexecute property for?
Developing an application in c# I came across the property UseShellExecute in the following code snippet: ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.CreateNoWindow = false;…
-
8
votes1
answer122
views -
8
votes1
answer127
viewsStatic members are collected by GC when no longer needed?
In a class that has a static variable, it exists throughout the application. The linked object is collected at some point? Example: public class Exemplo { private static List<int> lista = new…
-
8
votes1
answer156
viewsWhat are symbols in the . NET Framework?
How do symbols work in the . NET Framework (and other platforms)? How do they make it possible to debug application even without having the source code on the machine? What is your relationship with…
-
8
votes4
answers3416
viewsHow to do a search to know if a string is inside a vector in C#
I’m doing a little program that searches inside a vector. The problem I’m having is that if he finds the name he gives a message saying it was found but then gives another message saying that it was…
-
8
votes3
answers1793
viewsHow to divide integers and get value with decimal part?
I am trying to divide the following values into c#: Double media = 0.0; int soma = 7; int cont = 2; media = soma / cont; Is returning 3.…
-
8
votes4
answers8025
viewsCheck if int is "null" in C#
Cannot assign on C# null at an integer value (int, nay int?). However, how can I know if an integer value (int) has not yet had an assigned value (being of the type int)? int? valor; if (valor ==…
-
8
votes2
answers927
viewsWhat’s the difference when creating a class libray (.net framework) and class library(.net standard) project in VS2017?
What are the differences and uses of these types of projects?…
-
8
votes3
answers230
viewsWhy are methods that operate pointers insecure in . NET?
Reading a bit of the . NET source code I realized that some methods have a peculiar modifier, the unsafe. [System.Security.SecuritySafeCritical] // auto-generated…
-
8
votes1
answer521
viewsWhat are the differences in ". NET"?
I took a look at this reply, but did not answer my question. As far as I know, there is .NET Framework, . NET Core, ASP.NET, . NET Standart and Mono but I don’t know the difference between them and…
.net terminology .net-core cross-platform portabilityasked 6 years, 8 months ago CypherPotato 9,292 -
8
votes2
answers695
viewsWhat is ASP.NET Core Blazor?
Looking at the list of novelties found in Visual Studio, I came across something talking about ASP.NET Core Blazor, and apparently there’s almost nothing talking about, I found very little material,…
-
8
votes1
answer1041
viewsCQRS - When to use and why to use?
What are the advantages of using the CQRS (Command/Query Responsibility Segregation) standard? What would be the disadvantages ?
-
8
votes1
answer107
viewsWhat does @ do in variable names?
In the response code of this question on Soen I found an unfamiliar statement line on C#. I tested this line and it works, but I didn’t understand the meaning of this character @ behind the member’s…
-
8
votes3
answers440
viewsGet the elements around a selected in the matrix
The idea is to create an integer array with the amount of user-defined rows and columns. Then an existing value in the matrix must be informed and the program must return the values immediately to…
-
8
votes2
answers114
viewsWhat is the function of Asreadonly() in C#?
I’m studying List in C#, I searched on the internet but still did not understand how it works. List<string> list = new List<string>(); list.Add("Maria"); list.Add("Lucas");…
-
8
votes2
answers139
viewsWhat is the default (Object) for in C#?
Sometimes I come across the keyword default in the C#: object obj = default(object); string str = default(string); int number = default(int); What good is? In which scenario can I apply this?…
-
7
votes2
answers2862
viewsHow do I turn my computer off, restart, sleep programmatically?
I would like to add these options in a program, after finishing a task the computer would be shut down/restart/put on Sleep. How can I do that?
-
7
votes1
answer1780
viewsHow do I know if at least one element of a list is contained in another list?
I have two lists: var lista01 = new List<int> { 1, 2, 3, 4, 5 }; var lista02 = new List<int> { 7, 7, 7, 7, 7 }; I need to check if at least one element of list 1 exists on list 2, then…
-
7
votes2
answers4107
viewsDictionary Search
I have the following Dictionary: public static Dictionary<string, string> ObterCodigo() { return new Dictionary<string, string> { {"18", "Teste"}, {"19", "Teste"}, {"02", "AAA"}, {"03",…
-
7
votes3
answers3924
viewsHow to know the week of a given month?
I am working on ASP.NET MVC 4, and I intend to know what is the week of a given month. For example, the user wants to set a frequency of occurrences, and as such says: The occurrence will happen…
-
7
votes6
answers5869
viewsHow to know the number of a week in each month
I am working on ASP MVC4, and would like to know the number of weeks in a given month to generate a list of dates. For example, the user inserts a week, and in that week of each month I will…
-
7
votes3
answers476
viewsUnmounting a USB Pen-Drive via code
I wonder how I can do to disassemble a removable drive(Pen-Drive) via c code#.
-
7
votes1
answer146
viewsIs there a specific type for passwords other than String in . Net?
I see very commonly the use of strings to store passwords in the program memory, not only on . Net, but in all the programming languages I’ve used. At first, I don’t see a problem in it. But as I…
-
7
votes1
answer3147
viewsHelp with setting up Dbcontext with Entityframework using good practices
I have my application divided into layers with Class Library and my layer with the Entity Framework, where I set up the DbContext, is the Repository. My inherited Dbcontext class: public class…
-
7
votes1
answer3070
viewsTo sort a list of objects by TWO properties
On this topic: How to sort list with complex object by one of its properties? is explained as ordering by a property, but as ordering by two? Taking into account the following product class:…
-
7
votes3
answers4237
viewsDate field 01/01/0001
I’m with a project Asp.net-mvc3 who owns a View that has a field to receive a type DateTime. In the database this field is required. The problem is that whenever I access the respective View, this…
-
7
votes3
answers11852
viewsHow to separate a String according to a separator in C#?
I have a string in this format: string valores = "Numero1#Numero2#Numero3#Numero4#"; How do I tell it in an array of integers to get it: int Numero[1] = Numero1; int Numero[2] = Numero2; int…
-
7
votes1
answer4965
viewsTransactionscope does not transact
I’m trying to use the TransactionScope in C#, I am performing the tests with local bank, but every time I try to execute some method it returns me this Exception: Partner transaction manager…
-
7
votes3
answers1618
viewsHow to intercept exceptions when working with the Entity Framework?
I want to handle errors returned by Entity Framework. In this example I am forcing the insertion of a duplicate record (Name already existing in the database and the table column is configured as a…
-
7
votes1
answer625
viewsDoes using Timer class features (System.Timers) cost a Windows service?
I need to do a database check once a day. I’m thinking of using the class Timer (System.Timers). The time contactor feature will burden/lock the other system services? This solution is advisable…
-
7
votes2
answers2337
viewsHow to make "Replace" replace all occurrences of a word without taking uppercase or lowercase?
The function Replace supersedes all occurrences of a word or expression, but taking into account uppercase and lowercase: string str = "Hello WorLLd";//Substitui só os 'l' e não o 'L' str =…