How do I do a get/post for an array in c#?

In C#, you get and set variables like this:

`public int ID { get; set; }`

How would one get and set an array in C#?

This will not work:

`public uint [5] BIG_Hash {get; set;}`
public uint[] BIG_Hash { get; set; }

...

obj.BIG_Hash = new uint[5]; // set

uint[] temp = obj.BIG_Hash; // get

The size is an attribute of the actual attached to the underlying object, not the object reference.

I kind of remember that I need separate methods for the set and get too that lines 5 and 7 need to be inside of.

I kind of remember that I need separate methods for the set and get too that lines 5 and 7 need to be inside of.

Yes, the "..." part is a placeholder for intervening code. Since it wouldn't compile, that's meant to show that this is a snippet. I used it so that I could highlight just the important lines of defining the property and using each of the get and set parts without junking up the example with boilerplate.

I vaguely remember using this in some code but it was long ago. How would the Get and Set methods look like? And how would the surrounding code be structured? Can I get a more complete picture?

Automatic property syntax is just some syntax sugar to make your life as a programmer a bit easier. It is meant for trivial get and set.
If you want something more elaborate, like an int property wich can only have values between 1 and 30, you have to use the regular property syntax. http://msdn.microsoft.com/en-us/library/bb384054.aspx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.