Questions tagged as 'c#'

3
answers

Lotofácil Betting Algorithm

One of the ways to bet on lotto is to choose 15 numbers from 1 to 25. I would like an algorithm in C # to generate bets. Remember that in each combination the numbers can not be repeated among themselves and bets should not be repeated. I alr...
asked by 27.03.2014 / 15:44
4
answers

How to dynamically create properties in C #?

In JavaScript it is easy to create an object with new properties. var obj = { "propriedade1" : "valor", "propriedade2" : "valor" } Is it possible to do something similar in C #? var lista = new List<Object>(); foreach (var ite...
asked by 08.06.2015 / 19:38
2
answers

How to sort by two properties in Linq

I have the following syntax and it is not working return View(trabalhos.Where(a => a.Usuario == User.Identity.Name && a.Data.Month == DateTime.Today.Month &&...
asked by 27.01.2017 / 19:41
5
answers

Is it possible to convert a 16-bit number to a single byte?

If I create the following expression: Int16 numero = 2017; byte m = (byte) numero; m will have the value of 225 . Ok, how do I get 2017 from the byte m (reverse operation) again?     
asked by 17.07.2017 / 19:20
2
answers

How to manage approval and production environments with Team Services?

I'm in an ASP.Net C # project that is starting now, but I come from ASP Classic , where things are quite different. In this new project, we need to create and manage homologation and production environments, where changes must go to the homo...
asked by 23.06.2016 / 22:22
1
answer

Should I use the types ushort, uint and ulong whenever the number is equal to or greater than 0?

Is it a good practice or is there something from Microsoft recommending the use of ushort , uint and ulong whenever I am sure the value will be equal to or greater than 0? Can I gain some advantage by using them instead of...
asked by 19.03.2018 / 00:10
2
answers

Receive variable value without passing parameter

I have the following method: private string toCamelCase(string text) { text = string.Format("{0}{1}",text.Substring(0, 1).ToLower(),text.Substring(1)); return text; } To use it I need to call it like this: toCamelCase("OlaMundo");...
asked by 26.11.2014 / 15:20
1
answer

Why can unboxing only be done for the type that was previously boxed?

I've been researching why there are unboxing and boxing , the answers I found say that there are value types in> reference types , for example in non-generic lists ArrayList . So is it correct to say that unboxing / Int32 doe...
asked by 17.07.2017 / 00:36
2
answers

Empty delegate (delegate {})

What does the delegate { } statement return? Would you be an empty delegate? In what situations would it be necessary to create an empty delegate?     
asked by 13.12.2016 / 01:17
6
answers

Converting a string to int?

What is the best way to convert a string variable to another variable of type int? , that is, nullable of int ? Performance is very important in this case because I will be converting multiple values into a loop. Wou...
asked by 24.02.2014 / 07:53