System.RuntimeType.GetGenericTypeDefinition C# (CSharp) Method

GetGenericTypeDefinition() public method

public GetGenericTypeDefinition ( ) : Type
return Type
        public override Type GetGenericTypeDefinition()
        {
            // No planned support
            throw new NotSupportedException();
        }

Usage Example

        internal static void GetUnitySerializationInfo(SerializationInfo info, RuntimeType type)
        {
            if (type.GetRootElementType().IsGenericParameter)
            {
                type = AddElementTypes(info, type);
                info.SetType(typeof(UnitySerializationHolder));
                info.AddValue("UnityType", GenericParameterTypeUnity);
                info.AddValue("GenericParameterPosition", type.GenericParameterPosition);
                info.AddValue("DeclaringMethod", type.DeclaringMethod, typeof(MethodBase));
                info.AddValue("DeclaringType", type.DeclaringType, typeof(Type));

                return;
            }

            int unityType = RuntimeTypeUnity;

            if (!type.IsGenericTypeDefinition && type.ContainsGenericParameters)
            {
                // Partial instantiation
                unityType = PartialInstantiationTypeUnity;
                type      = AddElementTypes(info, type);
                info.AddValue("GenericArguments", type.GetGenericArguments(), typeof(Type[]));
                type = (RuntimeType)type.GetGenericTypeDefinition();
            }

            GetUnitySerializationInfo(info, unityType, type.FullName, type.GetRuntimeAssembly());
        }
All Usage Examples Of System.RuntimeType::GetGenericTypeDefinition