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
-
6
votes2
answers2606
viewsCheck whether the previous day is a holiday and/or Sunday
I’m having trouble developing a date validation logic. The variable dataFecha is called with -1 day to already validate the previous day. But when I go to test the validations, he did not subtract…
-
6
votes2
answers3207
viewsWhat are the differences between ASP.NET MVC and ASP.NET Razor Pages?
What are the differences and limitations between ASP.NET MVC and ASP.NET Razor Pages? I was very curious, because apparently the Razor Pages use the MVC standard, but without the need to use a…
-
6
votes2
answers152
viewsTreat Exception by code
In Visual Basic 6 there was the command err.number where the error code is demonstrated. I have a C# app that we treat Exception by the description of the message because I did not find the command…
-
6
votes3
answers519
viewsHow does C# run on other platforms?
As a complement to this question, run C# on a system where . NET Framework is native, it is default to run the application executable. As far as I know, C# depends on the . NET Framework to be…
-
6
votes4
answers1049
viewsString list + . Split()
The command string.Split() separates a string in a array of the kind string[]. How to use the string.Split() to separate strings in a list List < string>?…
-
6
votes3
answers293
viewsHow to know if class instance inherits another class?
I’m using reflection to know if one class inherits another, what I found was this: bool herda = typeof(A).IsAssignableFrom(typeof(B)); But I want to do it in the variable getting your type. Here’s…
-
6
votes1
answer177
viewsWhen to use Memorycache?
I would like a real example, not necessarily a code, on when use the MemoryCache on Web systems. What types of situation ask for its use? A little context: I participated in an interview where they…
-
6
votes3
answers20560
viewsPick first and last name and abbreviate middle names only with the initial
I would like to address the following string: string nome = "Rafael Rodrigues Arruda de Oliveira" With the following criteria:: Keep first and last name; Abbreviate the other names (middle names)…
-
6
votes3
answers201
viewsRounding up
I have these values, where contrato.Count = 63 and 63/50 = 1.26. I’d like you to round up 2, I’m doing it this way: decimal arrendondamento = contrato.Count / 50; var valorArredondado =…
-
6
votes5
answers146
viewsIs there a disadvantage or is it harmful to use null types?
I always have trouble receiving null values from the database because I forget to use the cancellable types and face the same problem: The type cannot be null This usually happens with attributes…
-
6
votes1
answer138
viewsWhy do auto properties exist in C#?
I have a doubt, because in C# there are auto properties that are usually used like this: public double price {get; private set;} and because she’s a public she can be accessed directly and on top I…
-
6
votes1
answer247
viewsSize of a list list using list.Capacity
Creating a list of lists: List<List<int>> myList = new List<List<int>>(); I add elements in myList with 1 element: myList.Add(1); When I do debug.writeLine(myList.capacity)…
-
6
votes1
answer196
viewsWhat is the difference between performance between different types of string concatenation?
I know 4 different types of concatenation of string in the c#: // string Interpolation $"valor {variavel} R$"; // Verbating string @"texto qualquer pula a linha e continua o texto"; // concatenar 2…
-
6
votes2
answers236
viewsRemove unwanted characters from a List<string> without going through the list
Be the following excerpt a Windows Forms application. List<string> lista_strings = new List<string>(); for (int i = 0; i < 2000; i++) { lista_strings.Add("TST1234"); //preenchendo a…
-
6
votes1
answer57
viewsWhy can a double var store an int type?
Why a var of the kind double can store a var of the kind int? Using C# int x; double y; x = 5; y = 2*x; Console.WriteLine(x); Console.WriteLine(y); Console.ReadLine();…
-
6
votes1
answer99
viewsWhy do typed accessors run the process faster?
I was reading an article by how to improve the performance of a Reader data using ADO.NET and in this article he cites the use of Typed Accessors to perform this function, from what I understand it…
-
6
votes2
answers108
viewsLine breaking problems and correctly display real value conversion on C#
I made a simple C# code that asks you to enter name, age, weight, city and state, performs normally only that it appears some problems as instead of the weight being 60.5KG gets 605KG and wanted to…
-
6
votes1
answer219
viewsHow does the . NET "using" and Garbage interface work?
In a reply now deleted here on the site it seems that there was some confusion with the content indicating the use of GC.Collect() and how the using C# works. So how does it actually work using and…
-
5
votes3
answers1977
viewsHow to delete a file marked with the "Read only" attribute?
I am trying to delete a file that is marked with the attribute "Read only": Whenever the file is marked with the said attribute, I get the following exception: System.Unauthorizedaccessexception was…
-
5
votes2
answers147
viewsIs there in the framework . Net, any delayed reading class?
I wonder if in . Net there is some class that allows me to tell her how to read a data, but that DO NOT read immediately... only later when requested, this class reads and stores the value, in case…
-
5
votes2
answers1593
viewsHow to register dll . net using Inno Setup
I have a DLL written in C# and can’t register it using Inno Setup. An example of how to run this process would be useful.
-
5
votes4
answers3081
viewsLimit number of characters per line
It is possible to limit the number of characters per line of a textbox multiline using Windows Forms C# and . Net 3.5?
-
5
votes3
answers19154
viewsHow to take the path of the open executable in C#
How do I take the path of the project in c#? Is there any function? Or I have to write the full path on my application?
-
5
votes4
answers4168
viewsConvert string to Time
I got a column in the database that gets a guy varchar which corresponds the hours on my app ("HH:MM"). I need to convert this string to a type TIME and then concatenate with a type DateTime.…
-
5
votes2
answers6164
viewsGrab information from object Sender
How does the search for information through the Nder object work and in what situations can I use it, with what types of events? This is to avoid event redundancy. Where can I explore these…
-
5
votes2
answers1137
viewsStandards for user authorization/permission
There are other standards for user authorization/permission other than the Role-based access control standard implemented by Microsoft for technologies. NET?
-
5
votes4
answers661
viewsHow do I execute a method at the end of each method in my class C#
He had a father class and another daughter and would like to perform a certain method, as an event, always at the end of each call of the method of the daughter classes. How can I do?
-
5
votes2
answers422
viewsWhat are the possible cases of using a persistent connection?
I’ve been reading about Signalr for the last few days and basically realized that one of its main features is to maintain a persistent server connection with possible clients accessing the server.…
-
5
votes4
answers1684
viewsDynamically check which attributes of a Model have been changed?
I am developing an ASP.NET MVC 4 application and need to save the log of each change made in a Model object. Is there any native method or implementation already known to do this? Example: public…
-
5
votes1
answer9094
viewsHow to read folder and subfolder files?
I have a function to read the files in the folder, and it’s not working. I need a functional function that reads files from folders and subfolders. Follows the code: FolderBrowserDialog fbd = new…
-
5
votes1
answer560
viewsReport progress to the interface of an asynchronous method in C#
I have an app Windows Forms. This application will perform some processes that take some time to execute, so I would like to run them in parallel. Follows a little of what I’m trying to implement.…
-
5
votes1
answer486
viewsHow to extract the numerical part of a monetary value?
I have a string with the characters "R$ 1,000.60" and would like to extract only the characters "1,000.60". I tried using regular expression, but I couldn’t reach my goal. I got to this: string…
-
5
votes1
answer1258
viewsHow do I place a Password field in a Messagebox?
How to enter a field that I can put a password into MessageBox. I could call one form, but wanted something simpler and faster, I would like that when I click on a button it provides a field to put…
-
5
votes1
answer1334
viewsHow to create a window without using the GUI builder?
I’m starting to study C# and just like in Java, Ides provide resources that make it possible to build Guis easily by dragging components. The netbeans has a powerful construction tool where it is…
-
5
votes1
answer148
viewsImport is not working
Imports System.DirectoryServices ERROR MESSAGE: "Warning 1 Namespace or type specified in the Imports 'System.Directory.Services' doesn’t contain any public Member or cannot be found. Make sure the…
-
5
votes2
answers552
viewsDividing 1/2 in C#
In some videos on numberphile about the Zeno’s Paradox the teacher of the video tried to explain how this paradox worked using hands to hit Palamas (I do not know how to explain this but I will…
-
5
votes1
answer1589
viewsDoubt between Any and All in a lambda expression on a list
On a list, I have 12 records (hypothetical) and there is a field called ValorCampoFlag, where this field receives 1 or null, for example. If I do a validation on it and the result if there is at…
-
5
votes2
answers1527
viewsHow do I close/close a msgbox via code?
I tried to find out how I could do this, but I did not find anything clear. I want to know if it is possible to close the first msgbox, shortly after 2 seconds. Follows the Code: MsgBox("Iniciando…
-
5
votes1
answer1837
viewsWhat are the differences between a Datatable and a Datareader for Mysql queries in C#?
I am creating a C# project with Mysql, my connector follows the standard Singleton and use Mysqldatareader to recover the table data and popular a List so far ok. My problem started when I had to…
-
5
votes2
answers2303
viewsPrevent an application from being closed by the user through the task manager
I have a C# application that cannot be closed by the user. But even if I eliminate all the means to close the application, including by itself, it is still possible to finish the process by the task…
-
5
votes5
answers4008
viewsRegex take from one point to the other within a text
I have the following text:: From: .... blabla bla Message: blablabalab //linha em branco From: .... blabla bla Message: blablabalab //linha em Branco From: .... blabla bla Message: blablabalab How…
-
5
votes3
answers1828
viewsFormat Strings to RG
How can I format this String: 12345678x for this: 12,345,678-X ? I tried to use the String.Format but I couldn’t. Solved: public string RgFormat(object rg) { string strRg = rg.ToString(); return…
-
5
votes1
answer2771
viewsHow to get computer information with C#?
As information of the computer where the C#application is running, such as computer name, IP, status of the firewall, if you have antivirus installed, if antivirus is active, etc.
-
5
votes4
answers374
views -
5
votes1
answer557
viewsHow to get command line parameters / file path
I am developing an application, and accurate by parameters/commands next to the file path. For example, these flags: C:/caminho_do_arquivo -r C:/caminho_do_arquivo -v And in the code there would be…
-
5
votes1
answer543
viewsParameter of any type in method
I am building a method and would like it to extend into any type. For now I am using string but I would like the same to work for int, float, double and datetime. public static bool isNotNull(string…
-
5
votes1
answer841
viewsAdd Migration and update at runtime Entityframework
I am developing an application and the need arose to add Migration and run the update at runtime. I already have the whole part that loads the modules: public class ClientContext : DbContext {…
-
5
votes1
answer1820
viewsHow to convert string to double without rounding error?
Because the following command: Convert.ToDouble("199998,99") Results in: 199998.98999999 Already the command: Convert.ToDouble("199998,98") Results in: 199998.98000000001 ?…
-
5
votes2
answers2885
viewsBlocked cross-origin request
Hello, I am trying to load a page from another application into a div of my application using the jQuery load but my application is not loading the page and shows the following error message:…
-
5
votes3
answers899
viewsConvert data c#
Good people I’m having a problem with my code. I in my database have a field like date Only that after calling him to the program he also passes me the time , is something of the genre: 18-03-2015…