Sunday, 18 August 2013

JS object like collection in C#

JS object like collection in C#

After practicing with JS for some time I've moved to C#. I'm trying to
create an object with some properties in C#. In JS I could do it like
this:
var person = {
fname : "",
lname : "",
id : ""
}
I want to create something similar to this in C#. I've watched some tuts
and I'm a little confused. There are classes, dictionaries, hashtables. I
don't know where to start.
If there is a way to do it without using a constructor I'd prefer to use
it. Cus I won't be changing the values and using a constructer is a pain.
Object will have like 10+ property so typing them in a single line with
the correct order... uh, no.

No comments:

Post a Comment