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
-
9
votes1
answer242
viewsWhat are the differences between BCL and FCL?
The Base Class Library (BCL) Framework Class Library (FCL) are components of the .NET. This defines what each one does? What goes into each one?
-
9
votes2
answers2912
viewsWhat is the purpose of the Gethashcode() method?
I’m using Resharper to automate the method override Equals and the operator ==. One of the methods the tool has overwritten is GetHashCode: public override int GetHashCode() { unchecked { return…
-
9
votes2
answers4792
viewsWhat is Yenumerable and Yenumerator for?
I made a combo of questions about IEnumerable and IEnumerator not only to help me but to help everyone who needs a more didactic explanation. Question 1 Could someone explain in a more didactic way…
-
9
votes2
answers93
viewsMethod equivalent to Biginteger.and() in C#
I need to convert the java code below to C#: public static boolean verificaPermissao(BigInteger perm1, BigInteger perm) { if (perm1 == null || perm == null || (perm1.equals(BigInteger.ZERO) ||…
-
9
votes1
answer126
viewsA property occupies space in the object?
I was reading a question about properties and saw that she is at the same time one or two methods. Do you have any additional cost in memory and processing in using it? If you don’t use the code you…
-
9
votes1
answer98
viewsWhat are the benefits of using the => operator in common methods that are unrelated to Lists or Lambda Expression?
I asked the following question: What value is checked in a condition operation with a variable value assignment? and the user @Maniero answered me, however, in the reply he used an operator and that…
-
9
votes2
answers967
viewsHow to test private methods in C#?
How to test private methods using Microsoft.VisualStudio.Testtools.Unittesting and Moq My test class is like this: [TestClass] public class ClasseDeTeste { private MinhaClasseComMetodosPrivados…
-
9
votes2
answers1167
viewsForeach of C# vs Foreach() of EF6
Follows code: ForEach() of EF6: var result = ctx.Table.Where(x => x.User == "João").ToList(); result.ForEach(x => x.Read = true); ctx.SaveChanges(); foreach of the C#: var result =…
-
9
votes1
answer1028
viewsWhat is the maximum number of items I can put inside a List<T> in C#?
I have several questions of performance in my application. What is the maximum number of items I can within my List<T> and what is "acceptable" within good practice.
-
9
votes2
answers785
viewsArraylist versus List
Why in C# we should prefer to use the List instead of ArrayList?
-
9
votes2
answers993
viewsIs there the equivalent of Andalso and Orelse in C#?
In VB.NET there are two interesting operators: the AndAlso and the OrElse. When used, the logical expression is not evaluated in full immediately. See the following example: If (Not Usuario Is…
-
9
votes2
answers1801
viewsAsync/Await with threads (C# 7.2)
I have this code and as you can see I created two examples, Parallel and Notparallel. I expected both to return me 3000ms, because both should run async (2000 and 3000) and the total time would be…
-
9
votes2
answers228
viewsIs Tuple the same as creating an object?
I’ve used the Tuple a few times and today came the doubt, that: public class User{ public String Name {get; set;} public String LastName {get; set;} } new User(){ Name = "Leonardo", LastName =…
-
9
votes2
answers674
viewsDo I need to use Visual Studio to program in C#?
I want to learn C# to become one of my main languages, but my current PC is kind of outdated and ends up not running Visual Studio well, but with Visual Studio Code it’s okay, I need Visual Studio…
-
9
votes5
answers1894
viewsTest for string fill
When reading a post on good programming practices, more related to validating the filling of strings, I came across the following: Very slow check: string ret = String.Empty; if…
-
8
votes3
answers920
viewsCan using non-priminal variable type in C# affect performance?
Using non-priminal variable type in C# can affect performance? I have seen several codes where, instead of using primitive C#types, many use types similar to other languages that the IDE accepts. I…
-
8
votes6
answers1227
viewsProperty readonly . NET
I received this question in a test and could not answer: "How is it possible to declare a property readonly in . NET / C#?"
-
8
votes3
answers853
viewsHow to replace hexadecimal value in a binary file?
Can you tell me how to replace the Hex value of a file with C#? Example: replace 62 61 72 ("bar") for 66 6F 6F ("foo").
-
8
votes2
answers3377
viewsHow to count lines of code in a . NET Solution?
What are all solutions (free or not) to count lines of code in a solution. NET? Use two Visual Studios: 2012 and 2013.
.net visual-studio-2013 visual-studio visual-studio-2012asked 10 years, 7 months ago Leonel Sanches da Silva 88,623 -
8
votes1
answer492
viewsHow to get the generic type entity type from the top interface?
I have the following situation: public class MinhaClasse : IMinhaClasse<Carro> { //... } public static void Main(string[] args) { var foo = new MinhaClasse(); } It is possible to get the…
-
8
votes1
answer862
viewsCapture buttons pressed on video game control reliably
I want to use an Xbox controller to control a program. It’s not a game, it’s just an app Windows Forms. I don’t want to use XNA because I don’t want to force the redistributables to download when…
-
8
votes2
answers129
viewsGet user-created methods
I have a method that lists the methods that a given object has, I want to take only the methods created by the user, in this case: Add and Subtract. What this method returns to me: Generic Class…
-
8
votes1
answer1158
viewsRecommended form for popular variables with database data
Assuming this fictitious method to obtain database data, say SQL Server: public List<DadosDTO> ObterDados() { try { comand = connectionFactory.CreateCommand(); comand.CommandText = "SELECT…
-
8
votes2
answers1879
viewsWhat are the differences between background and foreground threads?
What are the differences between these two types of threads: background and foreground?
-
8
votes1
answer2897
viewsWhat is Bind(Include = "Property") used for?
By creating a CRUD with scalfold in ASP.NET MVC, in POST, we have the following code: public ActionResult Create([Bind(Include = "Id,Nome")] Grupo grupo) {...} What’s this one used for [Bind]? When…
-
8
votes2
answers385
viewsIn which scenario is it recommended to use Keyedcollection instead of a Dictionary?
I didn’t know about the existence of KeyedCollection until you see this reply gypsy. I wondered how and when to use a KeyedCollection, since there is the Dictionary which apparently has the same…
-
8
votes1
answer1863
viewsEncrypt Web.config
I come here with a question about ConnectionStrings of Web.config. Seeing that normally, we inform a form of authentication on ConnectionStrings for the application to access the database. And by…
-
8
votes1
answer2080
viewsRandom() generating repeated numbers
I am developing a small application to perform XML import, which searches the items present in the note and performs the search for them in DB company. When the item is not found, the link is done…
-
8
votes3
answers1704
viewsWhat is the use of Func<T, Tresult>
I was researching some things and came across the Func<T, TResult>, and I didn’t quite understand his usefulness. For example: //Método public string Nome(string nome) { return "Meu nome é " +…
-
8
votes2
answers1180
viewsIs it possible to link a C# form to a VB.NET project?
I have two different projects, one with only one form in C#, I can embed the form in my project in VB.NET ?
-
8
votes8
answers2805
viewsHow to know which is the last element on a list?
I am doing a dynamic sql query, in which I use lists, my problem is, how to know which last element of this list Follow the code made so far: List<string> campos = new List<string>();…
-
8
votes1
answer347
viewsHow to create an html log with log4net
I have a project that already uses log4net, but I would like to show this log in HTML. I searched several sites and nobody implemented this solution. Does anyone have any idea how to do that?…
-
8
votes2
answers121
viewsDeclaration of an interface with Where
I’m studying a lot Pattern design, because I think they solve a lot of things and it is very opportune to study them. I took this statement on the Macoratti website and I confess, I could not…
-
8
votes3
answers224
viewsUse of using versus full name
I’ve been following many projects open source and I realized that there’s a really big alternation between using using (Imports in VB.NET) and use direct reference to the namespace. Example: void…
-
8
votes3
answers1242
viewsLINQ with Where condition using variable
I have the following table: USUARIO Nome | Idade João | 21 Maria | 18 I want to do in only one consultation return all users, or return only users of specific age based on a C variable#. Also by…
-
8
votes2
answers339
viewsWhere to put Data Annotation? View Model or Model?
Using Entity Framework Code First, with view model and model. To create a column with varchar(2), need to put the MaxLength(2) in the model and in the view model?…
-
8
votes1
answer7864
viewsFunction to generate random alphanumeric characters
I need a C# function that manages a String of random alphabetic and numerical characters of size N.
-
8
votes3
answers576
viewsSession Limitation to Save Data
I have a query slow in Oracle to list all the accesses of a user, so I thought to record the result in a Session, the average of records returned is 600, it’s too much for a Session? Would there be…
-
8
votes1
answer11054
viewsStreamwriter Special Characters with Encoding.ASCII C#
I am writing in a file via Streamwriter using the encoding Encoding.ASCII. A situation has appeared where I need to write the letter "Ç". Only if I try to do that, the file leaves the character "?".…
-
8
votes3
answers3818
viewsUpdate an item from a generic list to a specific item
How do I update a specific element of a generic list by locating by ID and passing an updated object in its place, updating the name and email? class Program { static void Main(string[] args) {…
-
8
votes1
answer374
viewsWhat is ADO.NET for C#?
I’m starting to learn about C# for web applications, and I wanted to know what ADO.NET is and what are the advantages of using it?
-
8
votes2
answers323
viewsWhat is the @ in a view and controller for?
I program in PHP and I’m starting to learn how to program in C# ASP.Net MVC, but I’m having some questions: What is the purpose of @ (arroba) both in controller how much in the view ? What are these…
-
8
votes1
answer497
viewsWhat is DNX really?
A long time ago I asked here what is the Runtime Environment, especially on the .NET. platform. It turns out that now . NET has DNX which is ". NET Execution Enviroment". In practice we use DNX to…
-
8
votes4
answers2691
viewsReports with Asp.Net MVC
Hello, I would like to know some options of reports with Asp.Net MVC. I tried to use Reportviewer but it gets typed with the bank and not to use with objects. Would anyone have any suggestions?…
-
8
votes4
answers542
viewsWhy use block using in ASP.NET MVC?
The block using {} works in the same way in both web applications and desktops in the sense of when we use it in controller? It is a good practice to declare it in the actions that there is contact…
-
8
votes1
answer173
viewsAddorupdate - use array as parameter
I’m doing tests with Entity Framework and I had a problem when placing a array as a parameter. Why when I assign the conversion of array in a function variable and directly in the method parameter…
-
8
votes2
answers576
viewsNotice: "Possible Multiple enumeration of Ienumerable"
I was doing some operations where I use collections. In one of these I needed to take a break (range) of numbers and I did the following: var range = Enumerable.Range(0, 4); And then I tried to do…
-
8
votes1
answer355
viewsCentralize (use only one) a Try-catch for every WPF application
Is there any way to centralize a try-catch for every application in a WPF application with C#? I created a window to use as MessageBox customized. When there is an error in any system registration…
-
8
votes1
answer112
viewsCan you use a dialog to open both folders and files?
Well, I’m using the openfiledialog to open files, however the software needs to receive files or folders, because it compressed and zipped (.zip) and then make a symmetrical cipher. I have searched…
-
8
votes1
answer452
viewsWhat is a type class "class Minhaclasseexample<T> Where T: new(){}"?
A class class ExemploClass<T> is a list? See the example class below: public abstract class MinhaClasseExemplo<T> where T: new() { public T value {get; set;} } Which means every part of…