示例#1
0
 protected virtual TConverterBase CreateInstance()
 {
     if (((this.ConverterType == typeof(EnumConverter)) && (this.TargetType.UnderlyingType != null)) && this.TargetType.UnderlyingType.IsEnum)
     {
         return((TConverterBase) new EnumConverter(this.TargetType.UnderlyingType));
     }
     if (this.ConverterType == null)
     {
         return(default(TConverterBase));
     }
     if (!typeof(TConverterBase).IsAssignableFrom(this.ConverterType))
     {
         throw new XamlSchemaException(System.Xaml.SR.Get("ConverterMustDeriveFromBase", new object[] { this.ConverterType, typeof(TConverterBase) }));
     }
     return((TConverterBase)SafeReflectionInvoker.CreateInstance(this.ConverterType, null));
 }
示例#2
0
 protected virtual TConverterBase CreateInstance()
 {
     if (ConverterType == typeof(EnumConverter) &&
         TargetType.UnderlyingType != null && TargetType.UnderlyingType.IsEnum)
     {
         return((TConverterBase)(object)new EnumConverter(TargetType.UnderlyingType));
     }
     else if (ConverterType != null)
     {
         if (!typeof(TConverterBase).IsAssignableFrom(ConverterType))
         {
             throw new XamlSchemaException(SR.Get(SRID.ConverterMustDeriveFromBase,
                                                  ConverterType, typeof(TConverterBase)));
         }
         return((TConverterBase)SafeReflectionInvoker.CreateInstance(ConverterType, null));
     }
     return(null);
 }
示例#3
0
 private object CreateInstanceWithActivator(Type type, object[] arguments)
 {
     return(SafeReflectionInvoker.CreateInstance(type, arguments));
 }