Questions tagged as '.net'

2
answers

What's the difference between using (int) variable or Convert.ToInt32 (variable)?

What's the difference between them? When is it best to use one or the other? Examples: string palavra = "10"; var numero = Convert.ToInt32(palavra); // ou (int)palavra ? string palavra2 = "10.50"; var numero2 = (double)palavra2; // ou Conv...
asked by 06.10.2015 / 15:39
2
answers

How do I round numbers to the nearest integer?

I have double numbers as double a = 0.4, b = 0.5; How do I round up?     
asked by 21.12.2013 / 17:59
1
answer

Is it possible to interact with C # code outside of .NET?

How do I call code written in another language that is not part of .NET, for example the C language? How does this interaction work? How do I call native Windows functions?     
asked by 09.08.2017 / 14:02
2
answers

What are the parameters out and ref

What are the ref and out parameter types of a method in C #? What's the difference between the two? Some examples of use of each.     
asked by 26.08.2015 / 14:08
3
answers

How likely is it to generate a Repeated Guid?

What is the probability of generating a Repeated Guid with Guid.NewGuid() ? I'm uploading numerous images from my system. The same will be a MultiTenancy, and will share the same Deploy, from the same folders. I assign the name of...
asked by 14.11.2014 / 18:46
3
answers

What is the "question mark" in the C # type declaration? [duplicate]

I saw this code written in C # on the internet: namespace Test { [MicroEntitySetup(TableName = "Users")] public class User : MicroEntity<User> { [Key] public int id { get; set; } public string Name {...
asked by 28.04.2016 / 20:26
3
answers

How to create a DateTime object that represents the last day of a given month?

In an object of type DateTime , how do I get a new object object DateTime that represents the last day of the month of the first object? var data = new Date(2017, 3, 1); // 01/03/2017 var dataUltimoDia = ??? // 31/03/2017     
asked by 09.12.2015 / 16:54
3
answers

When does not return Task in async methods?

Usually, in some time-consuming tasks, I use asynchronous methods: public async Task myLongRunningOperation(int i) { ... } However, in what situations do I not necessarily need to return a Task ? public async void myLongRunningOpera...
asked by 11.07.2017 / 04:02
2
answers

What is the main difference between int.Parse () and Convert.ToInt32 ()?

In C #, there are two ways (among others) to convert other types to int : Convert.ToInt32(valor) and Int32.Parse(valor) . What is the main difference between these two conversion methods?     
asked by 06.10.2015 / 18:41
2
answers

Ticket generation in .NET

To this day I have 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 research how to do this in .NET. I researched a little and all I fou...
asked by 15.12.2015 / 19:42