Most voted "c#" questions
This tag should be used when the question refers to some resource, information or problem related to the C#language. C# ("C Sharp") is a multi-paradigm programming language that has strongly typed variables, is imperative, declarative, functional, generic, object-oriented and component-oriented, which are designed to be executed in . NET Framework.
Learn more…13,899 questions
Sort by count of
-
14
votes3
answers2393
viewsDivergence in encrypting and decrypting in Java and C# Aes algorithm
I have two projects in Java and another in C# where the two communicate with each other, and one of the functions and encrypt and decrypt the confidential information between them, using aes…
-
14
votes2
answers529
viewsWhat is checked in the code in C#?
I saw a code: using (IEnumerator<TSource> e = source.GetEnumerator()) { checked { while (e.MoveNext()) count++; } } What is the purpose of the code checked {} in that code C#?…
-
14
votes2
answers225
viewsWhat is Fastexpando/Fastexpandoobject?
Was reading about Dapper and I came across a feature of him called Fastexpando or Fastexpandoobject, I didn’t understand very well and I had some doubts about this feature. Doubts What is…
-
14
votes3
answers8566
viewsWhat is CQRS and how to implement?
CQRS (Command and Query Responsibility Segregation) is one of those acronyms that we come across and we can’t fully understand its meaning and use. What is CQRS and how to implement?…
-
14
votes2
answers2969
viewsBillet generation in . NET
Until today I often imagined situations in which a system might need to generate boletos, although until now I have never developed anything like this, and so I decided to search how to do it in…
-
14
votes4
answers977
viewsSeparate repeated values in a list
I have a list like this: [1,1,1,2,2,1,5,3,4,3,4] How to generate a new list with only one value of each: [1,2,3,4,5] The first list is a List<int> the second can come in any kind of list.…
c#asked 7 years, 7 months ago Jhonatan Jorge de Lima 1,012 -
14
votes2
answers1007
viewsHow does a method that can receive multiple parameters work?
According to the C documentation#: The method String.Format is responsible for converting the value of objects in strings based on the specified formats and inserts them in another character string.…
-
14
votes3
answers2118
viewsMemorystream vs Stream
What would be the main difference between the two? There are advantages to performance gain? For web use, which is the most appropriate? I’m using to "read" a array Byte[]: private void…
-
14
votes3
answers285
viewsWhat is the function of #if false in C#?
I’m working on a project and I saw blocks of code with this #if false: What’s the difference to it (commented vs #if false) ?…
c#asked 6 years, 8 months ago Thiago Loureiro 2,465 -
14
votes5
answers2296
viewsWhat good is a C#?
I saw a class in C# that was stated like this, in a reply I read in Soen: public sealed class Link { // Resto do código } What is the key word for sealed in the above case?…
-
14
votes2
answers790
viewsPerform Stress Test on C#
I have the following scenario: There is a Windows Service, done in C#, which is used to synchronize data from a local database to a cloud base and need to perform some stress and charge, with this,…
-
14
votes1
answer497
viewsShould I use the ushort, uint and ulong types whenever the number is equal to or greater than 0?
Is it good practice or is there something from Microsoft recommending the use of ushort, uint and ulong whenever I am sure that the value will be equal to or greater than 0? I can gain some…
-
13
votes4
answers6431
viewsHow does the interaction between the layers in C# work and what is the function of each one?
Assuming a project with these layers: DAL, Controller, Negocio, Model and View I’m trying to learn C# seeing ready-made project codes, but not quite understood yet the correct order of creation and…
-
13
votes1
answer300
viewsControl the fan (fan) of the CPU in C#
How do I read and set the fan speed (fan) of the CPU and also read the current speed? I tried to use this code but also could not get result. [DllImport("Cimwin32.dll")] static extern uint32…
-
13
votes2
answers505
viewsIs it possible to program using the Winrt API without resorting to XAML?
Some time ago declarative languages took over the development of software for creating graphical user interfaces. The most obvious examples are the framework WPF that uses XAML (Extensible…
-
13
votes7
answers10092
viewsHow to make child form change values in parent form C#?
I have a register in C#. There is a "street search" button that opens a form search child. When executing the search, displays the result in the datagrid that form son. I would like the event…
-
13
votes3
answers6240
viewsWhat would be the best way to make a CRUD for a framework in the most generic way possible?
I’m studying to make a CRUD for a framework but I’m trying some problems to be able to do it in the most generic way possible. For example: have a class Pessoa() I want to do CRUD by passing only…
-
13
votes3
answers2226
viewsPerformance: string "concatenated" or all in the same line?
I have a loop with thousands of results that renders a table. The string is mounted through Stringbuilder in this way (sample snippet): ScriptTbody.AppendLine("</select>");…
-
13
votes1
answer671
viewsVisual Studio 2010 lag
I’m a beginner in programming and got a very good study material for Visual Studio 2010. My question is whether this version of the package is too outdated compared to 2013. For now, I’m only…
-
13
votes3
answers17303
viewsWhat is the best way to read an XLS file?
I would like to know the best way to read an XLS file in C#. I can handle it the same way I handle a database table?
-
13
votes1
answer2964
viewsCalculate force to reach point B from point A
I have the value of the starting point, the end point (target) and the initial angle of the object. I would like to know the strength to reach the end point, as in the image below. Is there a…
-
13
votes1
answer1813
viewsWhat is the difference between Action, Predicate and Func
What’s the difference between Action, Predicate and Func in the C#? I would like, if possible, examples of use.
-
13
votes1
answer718
viewsWhy should I use the Stringbuilder class instead of the String class?
Why these two classes are different, because it seems to me that they could be one class. For example, the method Append, it seems to me that he does the same thing as the operator +.…
-
13
votes5
answers554
viewsError passing URL as parameter... Joeblogs & Htmlagilitypack
Main namespace ReaderXML { class Program { static void Main(string[] args) { var website = LeitorDeXML("http://SITE ORIGEM/").ToArray(); var total = website.Count(); for (int i = 1; i < total;…
-
13
votes2
answers1019
viewsConvert.Tostring() and . Tostring()
Is there any glaring difference between them? Whether in performance or ways of dealing, what are their particularities? What would be the correct way to use (if there is any difference)?
-
13
votes4
answers590
viewsInteraction between forms?
In my program, I inserted a button and a panel. When the button is clicked, logic inserts another form into the panel superimposing the form initial. In the form2 that appears has a return button,…
-
13
votes2
answers618
viewsHow to list methods of a class in C#?
Again I have to say this: I come from PHP and am learning C# now. I usually like to list the methods that the class has, because I always did this in PHP, to test or debug. $a = new ArrayObject();…
-
13
votes2
answers141
viewsHow to Lambda in Extension Methods with Multiple Lists?
There are the following Objects: public class Objeto1 { public List<Objeto2> PropObj1 {get; set;} } public class Objeto2 { public List<Objeto3> PropObj2 {get; set;} } public class…
c# .net entity-framework linq lambda-expressionsasked 9 years, 3 months ago Jedaias Rodrigues 6,718 -
13
votes3
answers1482
viewsWhy does Visual Studio suggest simplifying names? - IDE0001 Name can be simplified
Visual Studio 2013 suggests name simplifications, as you can see below: The suggestion is: IDE0001 Name can be simplified Translation : IDE0001 Name can be simplicate Example: var obj = new…
c# string visual-studio-2013 visual-studio encoding-styleasked 9 years, 3 months ago Guilherme de Jesus Santos 6,566 -
13
votes2
answers864
viewsDifferences between Jagged Array and Multidimensional Array in c#?
There is difference in these arrays in c#? int[][][] int[,,] As far as I can see, it’s the same thing, but c# can’t cast from one to the other.
-
13
votes2
answers241
views -
13
votes3
answers569
viewsWhat are the consequences of programming in 32 bits or 64 bits?
It would only be the memory capacity that is limited to 4 GB in 32 bits? I need to have specific concerns? I know what’s different about C, I want to know about C#.
-
13
votes1
answer498
viewsWhen does the Entity Framework execute the query of a Iqueryable?
I am developing a method for an API that consists of the following: fetching all customer reviews and, if specified, limiting the amount of records that will be returned. For example: public…
-
13
votes1
answer1673
viewsHow to do a text break in Excel programmatically with a C check #
I am using the Microsoft.Office.Interop.Excel to create an Excel report from a txt file. Everything works perfect, but sometimes some columns become extremely large and when we need to print, it is…
-
13
votes1
answer236
viewsIs it possible to interact a C# code with code external to . NET?
How to call code written in another language that is not part of . NET, for example the language C? How this interaction takes place? How to call native Windows functions?
-
13
votes3
answers1511
viewsHow can I replace a part of a string by itself plus the "~" character?
How can I replace a part of a string by itself plus the character "~"? I’m doing it this way: only when the string has two equal numbers as the 51 that comes just after AP and the contained in the…
-
13
votes1
answer292
viewsWhat is the difference between "using" and "using Static"?
In a question I asked about C#, @Maniero answered me and put an example code in Dotnetfiddle. The code is this: using static System.Console; public class Program { public static void Main() { var…
-
13
votes2
answers2090
viewsWhat is the IL code and where can I find this code?
In my question about static builders the user Maniero showed how is the code generated from a static constructor by . NET, this code is called Code IL according to his reply. See the IL code of my…
-
13
votes5
answers453
viewsHow to separate "words" in Camelcase in C#?
How can I separate "words" into Camelcase using hyphen for example? String: string example = "CamelCase"; // CamelCase para: // Camel-Case and enumerator: enum Example { CamelCase }…
-
13
votes1
answer1859
viewsReasons to use private class
When I started in the area, in a course of POO (Object Oriented Programming) the teacher explained about access modifiers... I remember that on this very day he said that it would be possible to…
-
13
votes3
answers680
viewsHow do I read the output of a loop-based process? [C#]
Everything happens correctly to start the process, but when trying to get some kind of return of its execution through any of the available redirectors, be it input, output or error, the application…
-
12
votes2
answers6298
viewsHow to find the default printer and print plain text on a dot matrix printer on . NET?
We have a thermal printer that does not support printing graphic elements - in this case, I will have to send simple text to it. Considering that our application will run on several different…
-
12
votes3
answers16084
views -
12
votes1
answer267
viewsHow to unify redundant XML namespaces?
I have the following XML: <?xml version="1.0" encoding="UTF-8"?> <DataTable> <Columns> <DataColumn xmlns:i="http://www.w3.org/2001/XMLSchema-instance">…
-
12
votes1
answer1432
viewsAsp.net MVC adding application name to URL
I have a domain on a shared server and within it I have some subfolders that are set as applications on IIS 7. Within the main domain I created subdomains that redirect to applications/folders. Ex:…
-
12
votes2
answers7696
viewsGet the current date and time by internet in desktop application
I am implementing a system lock by date, and I need to get the current date of Brasilia for example, which would be the official time of Brazil, or the date in time zone -3. I believe that there are…
-
12
votes1
answer1319
viewsHow to install a Windows Service without Setup?
I have a Windows Service project in Visual Studio in C#, however, I need to install this project from lines of code, without use the Installutil of console nor the Setup of Visual Studio. There’s…
-
12
votes2
answers5287
viewsHow to implement the Repository Standard in C# with EF?
I want to make an implementation of the standard Repository where I will be using the Entityframework and have the following: Interface IRepository: public interface IRepository<T> where T :…
-
12
votes4
answers2351
viewsMerge word docx documents from a template and replace words
I need to get the contents of a file docx as template, which contains as content a text and some identifiers to be changed with other data, and from that template create a single other docx with the…
-
12
votes2
answers2282
viewsHow to do binary search in a txt file?
I am with a txt file that stores data from several books (example below) I would like to make a binary research that returns the line that is with the first field (ISBN of the book) equivalent to…