Click here to Skip to main content
15,911,315 members

Comments by Member 8255180 (Top 3 by date)

Member 8255180 3-Jan-12 17:12pm View    
Thank you all for your help with this. I guess, as we all do, like to make our code as clean as possible. C# is a great language but as I have seen today it does have it's limitations.

After studying the book "CLR with C#" by Jeffrey Richter I could code in the Class..

public string this[int i]
{
get{return myvalue;}
set{myvalue = value;}
}

Then in the calling method...

foo[0]="Test";

This seems to work, but why do I have to use an Indexer???



Member 8255180 3-Jan-12 14:13pm View    
My apologise, I didn't read the answer correctly...I meant without having to specify the Properties in the Object Initialiser. I have searched and I did not if there was an Attribute etc that I could set so, for instance f="Test" automatically goes to the Name Property
Member 8255180 3-Jan-12 12:55pm View    
Thank you, but is it possible using a Parameterless Constructor?