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

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
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
Reply to this message Reply
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
Reply to this message Reply
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
Topic: How do I solve issues with adding Tabbed Control with Expression Blend 3 ? Previous Topic   Next Topic Topic: How do I expose the LoadCompleted method in the WebBrowser class in WPF C#?

Sponsored Links



Google
  Web Artima.com   

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