C# Answers Forum - How do I do a get/post for an array in c#?

The Artima Developer Community
Sponsored Link

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

1 reply on 1 page. Most recent reply: Oct 6, 2014 8:51 AM by Matt Gerrans

Welcome Guest
Sign In

Flat View: This topic has 1 reply on 1 page
William Thompson

Posts: 11
Nickname: xarzu
Registered: Nov, 2007

How do I do a get/post for an array in c#? Posted: Sep 25, 2012 3:34 PM
Advertisement
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;}


Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: How do I do a get/post for an array in c#? Posted: Oct 6, 2014 8:51 AM
What you have there is a property, not a variable. If you really want to have an array which has exactly 5 values in it, you might define the property like this, with a read only backing array of exactly 5 values:
 private readonly uint[] _bigHash = new uint[5];
 
 public uint [] BigHash
 {
 get
 {
 return _bigHash;
 }
 }

Flat View: This topic has 1 reply on 1 page

Sponsored Links



Web Artima.com

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use

AltStyle によって変換されたページ (->オリジナル) /