1 Replies - 3238 Views - Last Post: 25 September 2012 - 02:50 PM

#1 complete  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 104
  • Joined: 12-April 07

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

Posted 25 September 2012 - 02:32 PM

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;}

Is This A Good Question/Topic? 0
  • +

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

#2 janne_panne  Icon User is offline

  • WinRT Dev
  • member icon

Reputation: 429
  • View blog
  • Posts: 1,047
  • Joined: 09-June 09

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

Posted 25 September 2012 - 02:50 PM

You almost got it right, the syntax for declaring array of uints as property is this:

public uint[] BIG_Hash { get; set; }



To set it, for example on class constructor, call it like this:
public MyClass()
{
  BIG_Hash = new uint[5];
  BIG_Hash[0] = 123;
}


Was This Post Helpful? 1
  • +
  • -

Page 1 of 1