system.type

C# type name instead of CLR type name

typeof(int).Name Will return System.Int32 does anyone know of a way to return "int" ...

Matching types using reflection in .NET

Hi, I am trying to use reflection to collect a property from a class that returns a certain type. However some of the properties I'm returning are strongly typed lists that house the type I want. Essentially I am trying to do the following: Public Function GetPropertyInfo(ByVal t as System.Type) for each pi as System.Reflection.Prop...

Best way to check if System.Type is a descendant of a given class

Consider the following code: public class A { } public class B : A { } public class C : B { } class D { public static bool IsDescendantOf(this System.Type thisType, System.Type thatType) { /// ??? } void Main() { A cValue = new C(); C.GetType().IsDescendantOf(cValue.GetT...

System.Type; implicit cast to string

Hello all, While looking at the System.Type class under the Code Definition Window, I cannot seem to understand how an instance of this class is implicitly cast to string. For example, on the following code: int foo = 0; Console.WriteLine("Hi! I'm a type of type {0}", foo.GetType()); How was the System.Type resulting from GetType() i...

How to "EnforceConstraints" to avoid linq errors?

Hello, I'm working on a sample from the book I bought. And, for unknown reason, I get the following error message " Could not find an implementation of the query pattern for source type 'System.Type'. 'Where' not found." The VS2008 help says that I need to add System.Linq and System.Collections namespaces to solve the issue. Unfortun...

System.Type.Missing or System.Reflection.Missing.Value when working with Office PIA?

I searched these SO results and couldn't find anything related to my question. I doubt this could be a duplicate. I'm currently writing a Microsoft.Office.Interop.Excel PIA wrapper in .NET C# 3.5 and was wondering about what is best to use while calling methods like opening a given workbook. System.Type.Missing or Missing.Value? I hav...