Custom Collection Class
-
Hi, I want to create a Custom collection Class Where i can store values by just CollectionObject.Key=Value; Is it Possible to do like this. If not is it possible to create dynamic properties to a class. Please Help me Thanks Sakthi.
-
Hi, I want to create a Custom collection Class Where i can store values by just CollectionObject.Key=Value; Is it Possible to do like this. If not is it possible to create dynamic properties to a class. Please Help me Thanks Sakthi.
-
Hello, You mean like this?
public object Key { get { return this.List\[List.Count-1\]; //Allways returns the last member of the List } set { if(!this.List.Contains(value)) { this.List.Add(value); } } }
All the best, MArtin
Hi Martin, Thanks for your reply. CollectionObject.Key = Value; Key here refers the key to be stored in the collection class for Reference. Forexample Dictionary MyDict=new Dictionary() MyDict[Key] = Value; Instead of using [](Square Braces i just want to use dot(.) Symbol. Regards, Sakthi.
-
Hi Martin, Thanks for your reply. CollectionObject.Key = Value; Key here refers the key to be stored in the collection class for Reference. Forexample Dictionary MyDict=new Dictionary() MyDict[Key] = Value; Instead of using [](Square Braces i just want to use dot(.) Symbol. Regards, Sakthi.
-
Hi Martin, Thanks for your reply. CollectionObject.Key = Value; Key here refers the key to be stored in the collection class for Reference. Forexample Dictionary MyDict=new Dictionary() MyDict[Key] = Value; Instead of using [](Square Braces i just want to use dot(.) Symbol. Regards, Sakthi.
This is a really strange idea! All possible keys must be known at compile-time. However, technically this can be achieved by adding a Dictionary member to you custom Collection and provide a property for each possible key that just wraps the indexer of the dictionary.
Regards, Tim
-
This is a really strange idea! All possible keys must be known at compile-time. However, technically this can be achieved by adding a Dictionary member to you custom Collection and provide a property for each possible key that just wraps the indexer of the dictionary.
Regards, Tim
Tim Paaschen wrote:
This is a really strange idea!
I do agree!
Tim Paaschen wrote:
and provide a property for each possible key
Think about that again! (He will set a long time infront of his computer, and than one day his heart will stop beating) As we all don't whant him to die infront of the computer writing this "strange" program, we should tell him to search for a better solution! All the best, Martin
-
Tim Paaschen wrote:
This is a really strange idea!
I do agree!
Tim Paaschen wrote:
and provide a property for each possible key
Think about that again! (He will set a long time infront of his computer, and than one day his heart will stop beating) As we all don't whant him to die infront of the computer writing this "strange" program, we should tell him to search for a better solution! All the best, Martin
Hi, Thank you very much for your Suggestion and Concern. Regards, Sakthi.
-
Tim Paaschen wrote:
This is a really strange idea!
I do agree!
Tim Paaschen wrote:
and provide a property for each possible key
Think about that again! (He will set a long time infront of his computer, and than one day his heart will stop beating) As we all don't whant him to die infront of the computer writing this "strange" program, we should tell him to search for a better solution! All the best, Martin
Martin# wrote:
Think about that again! ...
I never said that it is a good idea - just that it is technically possible.
Regards, Tim
-
Martin# wrote:
Think about that again! ...
I never said that it is a good idea - just that it is technically possible.
Regards, Tim
Hello (Hallo) Tim,
Tim Paaschen wrote:
I never said that it is a good idea
I know, and my answere was more meant as a joke than a critic on your statement.
Tim Paaschen wrote:
just that it is technically possible
Technically possible, would be a set of keys which he defines during design time. "All possible Keys" is not technically possible! All the best (Noch einen schönen Tag) Martin