Re: Get/Set Property for Array
- From: "Mr. Arnold" <MR. Arnold@xxxxxxxxxx>
- Date: Fri, 22 May 2009 19:48:49 -0400
"Ben Voigt [C++ MVP]" <rbv@xxxxxxxxxxxxxxxxx> wrote in message news:20133A11-4A55-478A-A530-D16C2D358DF3@xxxxxxxxxxxxxxxx
"Mr. Arnold" <MR. Arnold@xxxxxxxxxx> wrote in message news:#JbwVOv2JHA.1196@xxxxxxxxxxxxxxxxxxxxxxx
"jp2msft" <jp2msft@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:421A7840-018C-431D-A839-0C2941647E65@xxxxxxxxxxxxxxxxI've got a small array that is part of a class.
I know how to create the 8x8 array and fill the 8x8 array, but FxCop and
Microsoft's "Best Practices" frowns on declaring the array as "public".
So, how should one access array elements from outside of the class?
Obviously, 8x8=64 public properties for each array element is absurd.
Microsoft's DataTable has the Rows method that can be accessed as:
for (int i = 0; i < DataTable1.Rows.Count; i++)
Console.WriteLine("Row {0}: {1}", i, DataTable1.Rows[i][0].ToString());
My goal is to learn how to access arrays in my class similar to the
DataTable's array of values.
Here is an example.
private Arraylist _jpmsft = new Arraylist();
What's this Arraylist? Never run into it before. And if you mean System.Collections.ArrayList, that's been dead since Visual Studio 2005.
The ArrayList has been dead since VS 2005, when I just instantiated an ArrayList() object in VS 2008 from the System.Collections?
Just because you don't use something does that make it dead. If I have a need to use an Arraylist, then I going to use one. You may have a different opinion. <G>
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4098 (20090522) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
.
- References:
- Get/Set Property for Array
- From: jp2msft
- Re: Get/Set Property for Array
- From: Mr. Arnold
- Re: Get/Set Property for Array
- From: Ben Voigt [C++ MVP]
- Get/Set Property for Array
- Prev by Date: Re: C# 3.0 extension methods: best practice for when to use
- Next by Date: Re: How can I handle error -2147012889 returned from HttpWebRequest ?
- Previous by thread: Re: Get/Set Property for Array
- Next by thread: Re: Get/Set Property for Array
- Index(es):
Relevant Pages
|