[CSharp.net] Unterschied zwischen typeof und Type.GetType?
Alexander Zeitler
csharp.net at glengamoi.com
Thu, 25 Nov 2004 22:19:34 +0100
>
> An sich ist typeof() nix anderes als ein C# Shortcut auf
> .GetType() Methode
> eines beliebigen Objekts.
habe noch ein wenig getestet:
ich kann typeof(int) mit typeof(int) vergleichen
und bekomme true oder Type.GetType("int") mit
Type.GetType("int"), aber nicht gegeneinander.
Ich habe jetzt noch in der MSDN geguckt, da steht bei typeof
folgendes:
The typeof operator is used to obtain the System.Type object for a type.
Bei .GetType steht:
Gets the Type with the specified name.
Letztlich sind das aber doch beides Objekte vom
Typ Type (lt. MSDN).
Verwirrung macht sich breit.
Gruss
Alex