public static int Main () { Iface iface; Implementor i = new Implementor (); iface = i; if (iface.A () != 1) return 1; StructImplementor s = new StructImplementor (); Iface xiface = (Iface) s; if (xiface.A () != 2) return 2; return 0; }
public static int Main () { Iface iface; Implementor i = new Implementor (); iface = i; if (iface.A () != 1) return 1; StructImplementor s = new StructImplementor (); Iface xiface = (Iface) s; if (xiface.A () != 2) return 2; Console.WriteLine("passed"); return 0; }
public Abstraction() { this.implementor = Implementation.GetImplementation(); }
public abstract void SetImplementor(Implementor implementor);
/// <summary> /// Deserialize an object from an XmlReader and return it strongly-typed /// </summary> /// <typeparam name="T">The type to deserialize into</typeparam> /// <param name="reader">An XmlReader that will read the XML from which to deserialize</param> /// <returns>The deserialized object</returns> public static T DeserializeFromXmlReader <T>(XmlReader reader) { return(Implementor <T> .Deserialize(reader)); }
/// <summary> /// Deserialize an object from a string and return it /// </summary> /// <param name="resultType">The type to deserialize into</typeparam> /// <param name="xmlString">A string containing the XML from which to deserialize</param> /// <returns>The deserialized object</returns> public static object DeserializeFromString(string xmlString, Type resultType) { using (var sr = new StringReader(xmlString)) using (var reader = XmlReader.Create(sr)) return(Implementor.Deserialize(reader, resultType)); }
/// <summary> /// Serialize an object to an XmlWriter /// </summary> /// <typeparam name="T">Object type (usually inferred)</typeparam> /// <param name="obj">The object to serialize</param> /// <param name="writer">The XmlWriter to serialize to</param> public static void SerializeToXmlWriter <T>(T obj, XmlWriter writer) { Implementor <T> .Serialize(obj, writer); }
public virtual void SetImplementor(Implementor implementor) { _implementor = implementor; }
public ExtendedAbstraction(Implementor imp) : base(imp) { }
protected Implementor impl; //定义实现类接口对象 public void SetImpl(Implementor impl) { this.impl = impl; }
public override void Operator() { Implementor.Operation(); }
public Abstraction(Implementor imp) { implementor = imp; }
public void SetImp(Implementor imp) { this.Imp = imp; }
public void SetImp(Implementor implementor) { mImplementor = implementor; }
public void SetImplementor(Implementor implementor) { Implementor = implementor; }
public RefinedAbstraction(Implementor impl) { this.impl = impl; }
public override void Operation() { Implementor.Operation(); Console.WriteLine("Invoke in RefinedAbstraction"); }
protected Abstraction(Implementor implementor) { Implementor = implementor; }
/// <summary> /// Deserialize an object from an XmlReader and return it /// </summary> /// <typeparam name="resultType">The type to deserialize into</typeparam> /// <param name="reader">An XmlReader that will read the XML from which to deserialize</param> /// <returns>The deserialized object</returns> public static object DeserializeFromXmlReader(XmlReader reader, Type resultType) { return(Implementor.Deserialize(reader, resultType)); }
public Abstraction(Implementor implementor) { this.implementor = implementor; }
/// <summary> /// Serialize an object to an XmlWriter /// </summary> /// <param name="obj">The object to serialize</param> /// <param name="writer">The XmlWriter to serialize to</param> public static void SerializeToXmlWriter(object obj, XmlWriter writer) { Implementor.Serialize(obj, writer); }
public static T FromRow <T>(DataRow row) where T : new() { return(Implementor <T> .Create(row)); }
public override void Show() { Implementor.Show(this); }
public static T FromRow <T>(ExcelDocument.Row row) where T : new() { return(Implementor <T> .Create(row)); }
public RefinedAbstraction(Implementor imp) : base(imp) { }
public void SetImplementor(Implementor implementor) { this.implementor = implementor; }
public override void SetImplementor(Implementor implementor) { _implementor = implementor; }
public ConcreteCommandB(Implementor implementor) { this.implementor = implementor; }