The simplest example would be the built in class keyValuePair(of T,U). I would like to be able to name the key property and value property differently depending on the usage and the designtime intellisense show me those names instead of key and value. Could this be done with reflection.Emit? Can it be done another way?
This seems like a small scope, and only saving perhaps 1 class of 8 lines of code, but it has broader implications for more complex classes.
As another example I'd like to be able to write new
Dim item as KeyValuePair (of string, string)("LoanNumber", "LoanApplicationID")
or
KeyValuePair<string,string>("LoanNumber","LoanApplicationID") item;
and access in intellisense this type via:
var result=item.LoanNumber;
without having to create the following class in code every time I need a type with custom property names:
class LoanInfo
{
string LoanNumber{get;set;}
string LoanApplicationID{get;set;}
}
Don't get hung up on the use of keyValuePair, it was just for example since it functions close to what I want, but doesn't allow me to set the property names.
Is this possible?