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
votes3
answers178
viewsHow to capture a Nullreferenceexception?
When I test my application, it returns some specific data, but when the requested data is null, this untreated exception error appears I tried to capture him but I think I’m making a mistake. How…
-
6
votes1
answer694
viewsHow to pick up attribute dynamically
How I would make the following PHP code in C#? class teste{ public $x = 10; public $y = 10; } $n = new teste(); $a = "y"; print_r($n->{$a}); Note that dynamism is in the variable $a, in which if…
-
6
votes2
answers1387
viewsSimplify LINQ query with Contains
I have two questions regarding the LINQ consultations below: { //lista de itens do orçamento var ids = itensOrcamento.Select(p => p.Id); //Produtos - todos produtos cadastrados var produtos =…
-
6
votes1
answer356
viewsDevelop for x86 and x64 platforms
More and more operating systems are prioritizing the "version" 64bits, with this, developing applications for this architecture becomes increasingly attractive. Based on this scenario, I ask what…
-
6
votes1
answer1209
viewsSoftware license registration file issuance and control
I have a system to control and issue electronic license registration files, so I have control of how many machines my software can run. My teacher advised me to use the CPUID processor to validate…
-
6
votes1
answer439
viewsAdd grid data to database
I have a loan screen and in it I have a datagrid with a checkbox selection and I would like to add in the database only the line selected by the user, as I can do? Loan screen code: using System;…
-
6
votes1
answer297
views -
6
votes1
answer947
views -
6
votes2
answers334
viewsHow to protect an Assembly from decompilation?
Nowadays there are many water heaters and recompilers for . NET Framework, the guy goes there, makes an application and everyone who has a decompiler (for example IL Spy) can go there, select the…
.net security-guard cryptography decompilation .net-assemblyasked 8 years, 7 months ago CypherPotato 9,292 -
6
votes2
answers9189
viewsReturn today’s date in C# in specific format
My way out has to be "2015-02-01" I tried to get DateTime.Now.ToString("yyyy-m-d"), but she doesn’t 0 between days and months.
-
6
votes1
answer2378
viewsWhat are the differences in performance when using querys with EF vs ADO
What is the difference in performance when using the basic query methods SqlQuery<TElement> and ExecuteSqlCommand of Entityframework in relation to directly using the ADO.NET? If there is…
-
6
votes2
answers897
viewsHow to filter items that do not contain a word in a list?
I have a: List<Grupos> lista = new List<Grupos>(); And I have this code var txtFiltro = "noivas,unhas"; var palavrasFiltro = txtFiltro.ToLower().Split(','); matches = lista.Where(x =>…
-
6
votes2
answers195
viewsInserting single quotes into null fields
I created a very simple application to simulate a small client registration, but when testing the manipulation of data by the application I could see in the database that the fields that are null in…
-
6
votes2
answers519
viewsWhat is the best place to store the connection string?
There are some possible places to store the string connecting. Leave tied inside the code, app.config, Windows registry and configuration file. What is the best place to store string connection?…
-
6
votes3
answers413
viewsHow to replace dynamic chunk {{chunk}} of a string in C#?
I get a string dynamically generated example: "Dynamic text {{parametro1}} plus a piece of text {{parametro2}}". I have in C# a code similar to this: where the name is the same that is between keys…
-
6
votes2
answers2547
viewsHow to get out of a cycle in C#?
I need to get out of the foreach when the value is equal to 1 foreach (DataGridViewRow dr in dgvValetes) if(dr.Cells["valor"].toString()=="1") //Sair aqui I don’t know how to do...…
-
6
votes2
answers1543
viewsHow to select fields in a lambda expression query?
Through the select new from LINQ I can select which fields will be displayed in the query, for example: var subCategorias = from s in db.SubCategoria join c in db.CategoriaProduto on s.id_categoria…
-
6
votes1
answer480
viewsIn a C#console program, where is the main class set?
I’m doing my first console program in C#, just to do some tests. I have two classes: HelloConsole.MainClass and HelloConsole.Calc. I have the following code: using System; // Aprendendo o alias de…
-
6
votes4
answers281
viewsIs there a C# feature similar to PHP __call?
I have a lot of experience with PHP and, as I’m starting now with C#, it will be common for me to want to compare one language with another to find out if I can do something similar. In PHP, I can…
-
6
votes2
answers840
views -
6
votes1
answer1270
viewsCalculate cubic root
I’m having trouble creating the following Root and LN buttons. I have buttons that should be very similar as for example the normal square root and the log. I tried to create the following for the…
-
6
votes3
answers459
viewsDoes C# have a class for handling properties files?
In C# has some class for handling files properties? In Java I use the class Properties, I was wondering if you have a C equivalent#?…
-
6
votes1
answer185
viewsWhat is Level Trust of an ASP.NET application?
What is the purpose of setting up Level Trust in an ASP.NET application? It protects the server from something? It protects the application from something? In which case or for what reason it is…
-
6
votes2
answers335
viewsHow do the parameters that LINQ methods receive work?
How the parameters within these methods that receive these parameters work: <TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate) An example is the method…
-
6
votes3
answers1227
viewsIs there a Data Annotation that prevents data duplication in the Database?
How do I prevent data from being duplicated in the database using Data Annotation or via another validation?
-
6
votes2
answers141
views -
6
votes1
answer201
viewsDoes the keyword "async" really make the asynchronous method?
I was seeing a video (at 31:11 minutes) and there says that async does not make the method really asynchronous, it is more a "hint". As it was in English and I am not totally advanced, it was half…
-
6
votes3
answers269
viewsI need to sort a list in order that seems unusual
I have a query and want to sort this query by the attribute code. I did it as follows: consulta.OrderBy(c => c.Codigo); Result obtained: 1.01 1.A 14.04 14.11 22.01 3.04 30.01 4.01 40.02 Expected…
-
6
votes5
answers497
viewsPrint string in reverse
Why can’t I print that string in reverse? I know there is possibility to use another simpler way, but I want to understand the error. static void Main(string[] args) { string frase = "Diego lima de…
-
6
votes1
answer111
viewsCan LINQ be considered business rule?
Sometimes I pull active objects with LINQ expression. Utilise filtering with LINQ can be considered a business rule and in a scenario such as DDD (Domain-Driven Design)? What is the best place to…
-
6
votes1
answer527
views -
6
votes2
answers644
viewsArc tangent function in C#
I did the following calculation on the calculator: arctg(50/10) = 78,69° However, when doing in the code, using the function Math.Atan, the result is as follows: Is there any other way to calculate…
-
6
votes2
answers2918
viewsEntity Framework WITH (NOLOCK)
We can use the NOLOCK in the SELECT, thus avoiding the blockages with the commands of INSERT SELECT COUNT(Descricao) FROM Produtos WITH (NOLOCK) Is there any way to use the WITH(NOLOCK) in the…
-
6
votes2
answers68
viewsHow can I indicate the directory where my assemblies should be found?
My company has an installation that hits the gigabyte home. We have a set of applications in our installation that share the same libraries. By default, when . NET executes an application it looks…
-
6
votes3
answers284
viewsWhat should I observe when creating a hash code?
Still talking about the reply about hash code it was not clear what should be observed to produce good hash codes. I understood that it needs to be a number that doesn’t generate a lot of…
-
6
votes1
answer326
viewsHow to create a monolithic application executable. NET?
I wouldn’t want to do the deploy from the full DLL application, wanted something simple, no installer, wanted to generate only one executable file, but the . NET is all DLL-based. You can generate a…
-
6
votes1
answer155
viewsModeling with Code First so you can exchange databases
If I generate my database for Mysql using the concept of Code First is it possible to change it to SQL Server in the future with relative ease? Need to change the classes or just the config and the…
-
6
votes2
answers665
viewsWhat is the maximum size of an object in 32 and 64 bits?
Specifically the array can have up to 4 billion elements, I think, and the most common sizes of elements should be 4, 8 or 16 bytes. I ask, what is the maximum size that the object can occupy in…
-
6
votes1
answer83
viewsIs there any way to be notified that there will be a garbage pickup?
I’m studying about the Garbage Collector do . NET and wanted to know if there are any events that I can sign and be aware whenever a collection will be made.
-
6
votes2
answers368
viewsHow to get the properties of a type when using Generics C#
I have the following class: public class Pessoa { public int id { get; set; } public string Nome { get; set; } public DateTime DataNascimento { get; set; } } I’ve developed a method to get her…
-
6
votes2
answers210
viewsWhat do builders mean by this?
This builder has a this, what it really means? public class HelpController : Controller { private const string ErrorViewName = "Error"; public HelpController() :…
-
6
votes2
answers199
viewsHow to popular a model from a Datareader in C#?
I’m sorry I was so ignorant about that question. In PHP there was the possibility of using the "Fetchclass" of PDO that took all the results of a table and threw them in an object of a certain…
-
6
votes1
answer325
viewsThe Node in the World . NET would be CLR or . NET?
Since Node is a development platform server-side in JS... and . NET we have CLR (Common Language Runtime) the Node would be the CLR that compiles? Or a framework like . NET, as two import modules I…
-
6
votes3
answers2216
viewsHow to reverse an integer?
Note this statement: /* * Faça um programa que peça um numero inteiro positivo e em seguida mostre * este numero invertido. Exemplo: * o 12376489 * => 98467321 * */ Console.Write("Informe um…
-
6
votes1
answer73
viewsMeaning of expression <%# "example" %>
I’m used to seeing expressions like <%= "Olá" %> but I came across a code: <asp:Image id="imagemStatusDocumento" runat="server" ImageUrl='<%# ObtemImagem(Eval("NomeTipo")) %>' />…
-
6
votes1
answer793
viewsWhat is the use of Task.Yield?
The documentation of this method says: Method Task.Yield() - adapted from English Creates a task suitable which returns asynchronously to the current context when awaited. I read the his source code…
-
6
votes2
answers202
viewsWhy do we pass an object to the statement lock?
I’m working with multithreading and fell in a competition case. More than one thread accessed an I/O operation on the same file and so an exception was triggered. To solve the problem, I did so:…
-
6
votes2
answers413
viewsMemory management and release
1) When I create an object in which there is arrays and large variables, defining them as null, will help in the reduction? Within a method Dispose() - before they were of some value. 2) When I call…
-
6
votes3
answers1943
viewsRun Python and C# together
How can I in C# import, ie, execute some script in another language (Python)? Example: If you write "R" in a C#program, it executes a file if called ApertouR.py.
-
6
votes1
answer272
viewsSort list by string resemblance
I have a list of string: AAA BBB CCC ABB ABC ACC ACD The user will type what he is looking for, would like to take to the first positions, the most similar. Example: String: A Upshot: AAA ABB ABC…