G
Guest
I have a design question. I am creating a custom collection of products.
The unique key for the products is productId which is an integer.
By default, IndexOf(object obj), when obj is an int, would return the value
of obj because it returns the index of the item at position obj.
Thoughts I had were to let the default method perform the default behavior
and then create an overload as IndexOf(int index, ProductSearchCriteria
criteria) where ProductSearchCriteria is an enum with { Index, ProductId }
allowing the developer calling my class to specify the meaning of the int
when calling IndexOf().
I'd appreciate any feedback and especially any better ideas.
Thanks,
Dale
The unique key for the products is productId which is an integer.
By default, IndexOf(object obj), when obj is an int, would return the value
of obj because it returns the index of the item at position obj.
Thoughts I had were to let the default method perform the default behavior
and then create an overload as IndexOf(int index, ProductSearchCriteria
criteria) where ProductSearchCriteria is an enum with { Index, ProductId }
allowing the developer calling my class to specify the meaning of the int
when calling IndexOf().
I'd appreciate any feedback and especially any better ideas.
Thanks,
Dale