Questions tagged as '.net'

3
answers

What are these attributes in the properties?

What are the names of these "Attributes" and what are they used for? Examples: in a class declaration: [ComVisibleAttribute(true)] public sealed class SerializableAttribute : Attribute in a property declaration: [XmlElement] public...
asked by 23.12.2014 / 10:55
5
answers

Create objects within a List without for / foreach C #

private List<Compra> CriarCompras(int numComprasParaGerar) { List<Compra> lstCompras = new List<Compra>(); for (int i = 0; i < numComprasParaGerar; i++) lstCompras.Add(new Compra()); return lstCompras; }...
asked by 29.09.2015 / 14:43
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
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

Relationship between Middleware and Application Delegate

I'm studying OWIN and its Katana implementation by Microsoft. I've already asked about this here and the answers will help you get a good overview of the subject. Going deeper I found this doubt. In the specification two pro-operating objects...
asked by 27.05.2014 / 00:47
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
1
answer

What is the difference between WCF and a Web Services?

I've always worked with Web Services, but lately I've seen a lot about WCF, so my question came. What is the difference between WCF and a Web Services? Is there any improvement between one or the other or something that is better to use be...
asked by 26.06.2017 / 15:56
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

Do you really need the "Then" at the end of the If block?

The Visual Basic .NET compiler seems to ignore the reserved word Then , which is at the end of the If block. If (1 + 1 = 2) Then Console.WriteLine("Passou no teste.") End If And now, without Then : If (1 + 1 =...
asked by 22.10.2015 / 00:29
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