Beispiel #1
0
        //public static TypeSerializationInfo DictionaryItemInfo = new TypeSerializationInfo(typeof(DictionaryItem));
        public static IDictionaryItem CreateDictionaryItem(Type type)
        {
            Type[] genericArguments = new Type[] { typeof(object), typeof(object) };

            while (type != null)
            {
                if (type.IsGenericType)
                {
                    genericArguments = type.GetGenericArguments();
                    break;
                }
                type = type.BaseType;
            }
            return((IDictionaryItem)TypeHelper.CreateObject(typeof(DictionaryItem <,>).MakeGenericType(genericArguments)));
        }
Beispiel #2
0
 public virtual object NewItem()
 {
     return(TypeHelper.CreateObject(type));
 }