示例#1
0
        /**
         * Missing IsSubclassOf, this works well
         */
        public static bool IsSubclassOf(this Type type, global::System.Type parent)
        {
#if NETFX_CORE
            return(!parent.Equals(type) && parent.GetTypeInfo().IsAssignableFrom(type.GetTypeInfo()));
#else
            throw new NotImplementedException();
#endif
        }
示例#2
0
 public string ToStringWithCulture(object objectToConvert)
 {
     if ((objectToConvert == null))
     {
         throw new global::System.ArgumentNullException("objectToConvert");
     }
     global::System.Type type             = objectToConvert.GetType();
     global::System.Type iConvertibleType = typeof(global::System.IConvertible);
     if (iConvertibleType.GetTypeInfo().IsAssignableFrom(type))
     {
         return(((global::System.IConvertible)(objectToConvert)).ToString(this.formatProvider));
     }
     global::System.Reflection.MethodInfo methInfo = type.GetTypeInfo().GetMethod("ToString", new global::System.Type[] {
         iConvertibleType
     });
     if ((methInfo != null))
     {
         return((string)(methInfo.Invoke(objectToConvert, new object[] {
             this.formatProvider
         })));
     }
     return(objectToConvert.ToString());
 }