MSDN.WhiteKnight - Stack Overflow answers
Ответ на "When does Type.Namespace return null if instance represents a generic parameter"
Answer 70228868
Docs are contradicting, but correct in principle.
Type.Namespace
returns null when the namespace is not available from generic definition. One way to get this is MakeGenericMethodParameter:Type t=Type.MakeGenericMethodParameter(0); Console.WriteLine("IsGenericParameter: "+t.IsGenericParameter); Console.WriteLine("Namespace: "+(t.Namespace==null?"(null)":t.Namespace));
Another is to have a custom Type implementation (it's an abstract class everyone could derive from and override properties to do whatever they want).
Edit: Type.Namespace docs were fixed in PR https://github.com/dotnet/dotnet-api-docs/pull/7466/files
Content is retrieved from StackExchange API.
Auto-generated by ruso-archive tools.