Questions tagged as '.net'

6
answers

Empty semicolon no error?

I was working on a project and unintentionally ran into the semicolon that ended up being inserted well after a if . I was intrigued because Visual Studio did not point as an error, and when trying to compile the project I was successful....
asked by 08.12.2015 / 18:33
1
answer

Difference between Task and Thread

I need to create a C # executable and I have the doubts: Do with thread or do with task ? In practice is there any difference between using Task and the "traditional" multi-thread ?? Is it true that a task...
asked by 13.04.2016 / 18:57
2
answers

Compile string as code

How can I compile a string inside C #? Example: Console.WriteLine(\"Hello World\"); . As if it were a eval of JavaScript? I had a project to load a code into a text file or something else.     
asked by 10.05.2014 / 02:10
2
answers

What is the difference, in practice, between "" and String.Empty?

In .NET you can see the multiple ways to initialize a string with an empty value, commonly known as "double quote". Is there a proper way to do this? And what would be the practical difference between using: var nome = String.Empty;...
asked by 05.09.2016 / 15:33
2
answers

What is AntiForgeryToken?

What is AntiForgeryToken and what does it serve in an ASP.Net MVC application?     
asked by 09.09.2015 / 20:20
2
answers

What is the difference between "lambda" and LINQ? How to differentiate them in a sentence?

I often see terms like LINQ query and lambda expressions . Then the question came up, What I'm doing is a LINQ query, a lambda expression, or both? Ex1: var query = Produtos.Where(p => p.Descr.StartsWith("A")).Take(10); Ex2: var...
asked by 09.08.2015 / 04:07
3
answers

Format double with thousands and decimal

I have the following value: 43239.110000000001 I used this command: txtSomatorio.Text = String.Format( "{0:#.#,##}", somatorio); I achieved this: 43239,11 How do I display it like this? 43.239,11     
asked by 23.12.2014 / 18:45
2
answers

What kind of data (double, float or decimal) should I use to represent currency in .NET with C #?

Although I am aware of what would be best to use, I ask this question for teaching purposes since I see several examples of people using double in C #. But I've had problems with double for coin calculations and read in several pla...
asked by 01.04.2014 / 22:30
5
answers

Why wear shorts?

The type short corresponds to a 16-bit integer - it is literally syntactic sugar for type Int16 . Current processors are all 64 bits, even on most low-end machines. Some older machines still have processors with 32-bit architectu...
asked by 25.04.2014 / 00:21
4
answers

How to pass string by reference?

I passed a string as a parameter. From what I know it is passed by reference, so if I change anything in it within the method, when I leave it the value will continue to change. I did the test below and it did not happen what I expected. Am...
asked by 31.03.2017 / 13:21