特定のタイプになるように指定するメソッドがあります。
例えば
public MyLabels GetLabels<T>()
{
// I'd like to get the namespace of the type that T represents here
}
これどうやってするの?
特定のタイプになるように指定するメソッドがあります。
例えば
public MyLabels GetLabels<T>()
{
// I'd like to get the namespace of the type that T represents here
}
これどうやってするの?
typeof(T).FullName // namespace and class name
typeof(T).Namespace // namespace, no class name
How about
typeof(T).Namespace;
使用できますtypeof(T).FullName
。
その文字列には、クラス名と名前空間の両方が含まれています。