R
Rainer Queck
Hi NG,
I have a base class "Telegram". This class , as well as all descants have a
static public field "public static int TelegramNo = <a tlg no>;"
Now I added all descants of Telegram to a generic List<Type>:
List<Type> tlgList = new List<Type>();
TlgList.Add(typeof(Telegram1));
TlgList.Add(typeof(Telegram2));
The idea now is, that if I receive a tlg stream I look for a telegram
nummber in it, and then scan my tlgList for the right class to instanciat.
My problem now is, how can I do that?
A static field of a class I can access by :
int i = Telegram.TelegramNo;
but if I try the same with:
tlgList.TelegramNo I can't compile my code any more, because of
"System.Type has no definition for TelegramNo".
How can I get access to the static field, with out creating an instance of
Telegram?
Thanks for hints and help!
Regards
Rainer
I have a base class "Telegram". This class , as well as all descants have a
static public field "public static int TelegramNo = <a tlg no>;"
Now I added all descants of Telegram to a generic List<Type>:
List<Type> tlgList = new List<Type>();
TlgList.Add(typeof(Telegram1));
TlgList.Add(typeof(Telegram2));
The idea now is, that if I receive a tlg stream I look for a telegram
nummber in it, and then scan my tlgList for the right class to instanciat.
My problem now is, how can I do that?
A static field of a class I can access by :
int i = Telegram.TelegramNo;
but if I try the same with:
tlgList.TelegramNo I can't compile my code any more, because of
"System.Type has no definition for TelegramNo".
How can I get access to the static field, with out creating an instance of
Telegram?
Thanks for hints and help!
Regards
Rainer