Re: Get/Set Property for Array

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"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@xxxxxxxxxxxxxxxx
I'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



.



Relevant Pages

  • Modifying nTSecurityDescriptor via MIIS
    ... attribute for Active Directory user objects. ... I've run into dead ends with ... array but I'm getting extra bits (as compared to the original byte array ...
    (microsoft.public.platformsdk.security)
  • Modifying nTSecurityDescriptor via MIIS
    ... attribute for Active Directory user objects. ... I've run into dead ends with ... array but I'm getting extra bits (as compared to the original byte array ...
    (microsoft.public.dotnet.security)
  • Re: Get/Set Property for Array
    ... I know how to create the 8x8 array and fill the 8x8 array, ... how should one access array elements from outside of the class? ... If you had a class that held its own public properties called it Help.sc, and you needed them in a collection of strong typed classes then it's this. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Get/Set Property for Array
    ... I know how to create the 8x8 array and fill the 8x8 array, but FxCop and ... how should one access array elements from outside of the class? ...
    (microsoft.public.dotnet.languages.csharp)
  • IComparable Byte-Array Comparison
    ... I am trying to figure out how to make an IComparable Byte Array ... Comparison class in C# and keep running into dead ends. ... but wanted to ask on here if anyone had advice. ...
    (microsoft.public.dotnet.languages.csharp)