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;}
Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.
Create Account How it Workspublic int ID { get; set; }
public uint [5] BIG_Hash {get; set;}
public uint[] BIG_Hash { get; set; }
BIG_Hash = new uint[5];
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;}
private uint[] _bigHash = new uint[5]; public uint[] bigHash { get { return _bigHash; } set { _bigHash = value; } }
Edited by AceInfinity, 07 October 2012 - 06:54 PM.
Sorry to drag this back from the dead, but I feel the need to set the record straight. The "get; set;" syntax is valid, they're called auto-implemented properties in C#:
http://msdn.microsof...y/bb384054.aspx
The problem with the OP's code is that you can't set the size of the array with the auto-implemented property syntax.
Cheers!
Ax
static int[5] GetArray() { }
Edited by AceInfinity, 02 July 2013 - 11:29 PM.
That's not how you define a property in C#.
0 members, 0 guests, 0 anonymous users
Community Forum Software by IP.Board
Licensed to: Geeks to Go, Inc.