RE: Overloads Property Questions

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: WStoreyII (WStoreyII_at_discussions.microsoft.com)
Date: 09/24/04


Date: Fri, 24 Sep 2004 11:39:06 -0700

Jay,

You have lost me, let me retry to explain what i am doing.

I have a Collection Class Called Customers
this class has a few different fields that i would use as lookup fields for
the customer objects in its collection

List:
DateOfSale:Date
Item:String
Code:String
Name:String
Ect.

The Problem is that i Can not use overloaded Propertys Items because i cant
not have overloaded values of the same type and i have at least three strings

so what i did was created a enum that contains these values and then in the
item function they will pass the criteria and then the value that is to be
matched as an object.

I just wanted to know if there was a more efficent way of doing this.

WStorey II

Thanks Again.

"WStoreyII" wrote:

> I have a Collection Class That I am Creating ,
>
> In This Collection Class I have a default Property Item.
>
> My Problem is this I have about twenty different Criterias that can be used
> as a value in searching for this item.
>
> So i figured that i could use overloaded item property's, however it
> seems that i may not have an overloaded property of the same value type
>
> so what i have done is i made an enum that contains all of the different
> criterias and then took in as variables for the property the criteria and the
> value as an object
>
> With the exception of the fact that the value variables can be any object
> and so is
> not explicitly stated, this seems to work fine.
>
> My Question is , does anyone see any problems with this method that i have
> mentioned that i have not noticed.
>
> and also Does any one else no of a better way of solving this little dilema?
>
> Thanks Again,
> Really you guys are very Helpful In here!!!!
>
> WStoreyII