private XmlDeserializationProxyEngine <object> .ConstructorComparer GetConstructorComparer( params object[] availableObjects) { var engine = new XmlDeserializationProxyEngine <object>(new object(), typeof(object), null); engine.AdditionalXElements.AddRange(availableObjects.Select(o => new XElement(o.GetType().Name, new XAttribute("type", o.GetType().AssemblyQualifiedName)))); var comparer = new XmlDeserializationProxyEngine <object> .ConstructorComparer(engine, null); return(comparer); }
private XmlDeserializationProxyEngine<object>.ConstructorComparer GetConstructorComparer( params object[] availableObjects) { var engine = new XmlDeserializationProxyEngine<object>(new object(), typeof(object), null); engine.AdditionalXElements.AddRange(availableObjects.Select(o => new XElement(o.GetType().Name, new XAttribute("type", o.GetType().AssemblyQualifiedName)))); var comparer = new XmlDeserializationProxyEngine<object>.ConstructorComparer(engine, null); return comparer; }
/// <summary> /// Initializes a new instance of <see cref="LateBoundConfigurationElement{TTarget}"/>, /// specifying a default type. If <paramref name="defaultType"/> is null, and if no /// type is provided via the <see cref="TypeAssemblyQualifiedName"/> property after /// this instance of <see cref="LateBoundConfigurationElement{TTarget}"/> has been created, /// then this call and subsequent calls to the <see cref="CreateInstance(IResolver)"/> method /// will throw an exception. /// </summary> /// <param name="defaultType"> /// The type of object to create if <see cref="TypeAssemblyQualifiedName"/> is not specified. /// </param> /// <remarks> /// If the inheritor of <see cref="LateBoundConfigurationElement{TTarget}"/> can supply a /// default type, its default constructor should invoke this constructor, supplying /// the default type. /// <code> /// <![CDATA[ /// public class FooProxy : LateBoundConfigurationElement<IFoo> /// { /// public FooProxy() /// : base(typeof(Foo)) /// { /// } /// } /// ]]> /// </code> /// </remarks> public LateBoundConfigurationElement(Type defaultType) { _engine = new XmlDeserializationProxyEngine <TTarget>(this, defaultType, typeof(ConfigurationElement)); TypeAssemblyQualifiedName = _engine.TypeAssemblyQualifiedName; }