public static object Copy(object source) { if (source == null) { throw new ArgumentNullException("source"); } TypeAccessor ta = GetAccessor(source.GetType()); return(CopyInternal(source, ta.CreateInstanceEx(), ta)); }
public PropertyDescriptorCollection CreateExtendedPropertyDescriptors( Type objectViewType, IsNullHandler isNull) { // This is definitely wrong. // //if (isNull == null) // isNull = _isNull; PropertyDescriptorCollection pdc; pdc = CreatePropertyDescriptors(); if (objectViewType != null) { TypeAccessor viewAccessor = GetAccessor(objectViewType); IObjectView objectView = (IObjectView)viewAccessor.CreateInstanceEx(); List <PropertyDescriptor> list = new List <PropertyDescriptor>(); PropertyDescriptorCollection viewpdc = viewAccessor.PropertyDescriptors; foreach (PropertyDescriptor pd in viewpdc) { list.Add(new ObjectViewPropertyDescriptor(pd, objectView)); } foreach (PropertyDescriptor pd in pdc) { if (viewpdc.Find(pd.Name, false) == null) { list.Add(pd); } } pdc = new PropertyDescriptorCollection(list.ToArray()); } pdc = pdc.Sort(new PropertyDescriptorComparer()); pdc = GetExtendedProperties(pdc, OriginalType, String.Empty, Type.EmptyTypes, new PropertyDescriptor[0], isNull); return(pdc); }
public static T CreateInstanceEx <T>() { return(TypeAccessor <T> .CreateInstanceEx()); }