Can you pass parameters to properties?
-
Hi, A while back I was reading about passing parameters to C# properties and loving it. But I must have been dreaming because now (that I'm ready to use them) I can't find any mention of them. Was it only a dream? Thx, MAtt
-
Hi, A while back I was reading about passing parameters to C# properties and loving it. But I must have been dreaming because now (that I'm ready to use them) I can't find any mention of them. Was it only a dream? Thx, MAtt
No, you can pass parameters like this (excuse the pun)
public MyObject this[int index]
{
get
{
return (MyObject) InnerList[index];
}
}as you can see I've ripped this code from a CollectionBase derived class.
You can pass more than one param within the [] brackets Gary "A fellow with the inventiveness of Albert Einstein but with the attention span of Daffy Duck." Tom Shales talking about Robin Williams