Variant Class ============= AMPL base type, can store a number or a string Namespace :dn:ns:`ampl` Assemblies * AMPL ---- .. contents:: :local: Inheritance Hierarchy --------------------- * :dn:cls:`System.Object` * :dn:cls:`ampl.Variant` Syntax ------ .. code-block:: csharp public class Variant : IComparable, IDisposable .. dn:class:: ampl.Variant :hidden: .. dn:class:: ampl.Variant Fields ------ .. dn:class:: ampl.Variant :noindex: :hidden: .. dn:field:: ampl.Variant.swigCMemOwn :rtype: System.Boolean .. code-block:: csharp protected bool swigCMemOwn Constructors ------------ .. dn:class:: ampl.Variant :noindex: :hidden: .. dn:constructor:: ampl.Variant.Variant(System.Double) :type d: System.Double .. code-block:: csharp public Variant(double d) .. dn:constructor:: ampl.Variant.Variant(System.String) :type s: System.String .. code-block:: csharp public Variant(string s) .. dn:constructor:: ampl.Variant.Variant(ampl.VariantRef) :type other: ampl.VariantRef .. code-block:: csharp public Variant(VariantRef other) Methods ------- .. dn:class:: ampl.Variant :noindex: :hidden: .. dn:method:: ampl.Variant.CompareTo(System.Object) Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. :param obj: An object to compare with this instance. :type obj: System.Object :rtype: System.Int32 :return: A value that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes obj in the sort order. Zero This instance occurs in the same position in the sort order as obj. Greater than zero This instance follows obj in the sort order. .. code-block:: csharp public int CompareTo(object obj) .. dn:method:: ampl.Variant.Dispose() .. code-block:: csharp public virtual void Dispose() .. dn:method:: ampl.Variant.Equals(System.Object) Returns true if two Variants have the same type and value :type other: System.Object :rtype: System.Boolean .. code-block:: csharp public override bool Equals(object other) .. dn:method:: ampl.Variant.Finalize() .. code-block:: csharp protected void Finalize() .. dn:method:: ampl.Variant.GetHashCode() Get a hash code for this variant :rtype: System.Int32 .. code-block:: csharp public override int GetHashCode() .. dn:method:: ampl.Variant.ToString() Return a string representation of this Variant :rtype: System.String .. code-block:: csharp public override string ToString() Properties ---------- .. dn:class:: ampl.Variant :noindex: :hidden: .. dn:property:: ampl.Variant.Dbl If the variant represents a number, gets the number. Throws exception otherwise :rtype: System.Double .. code-block:: csharp public double Dbl { get; } .. dn:property:: ampl.Variant.Str If the variant represents a string, gets the string. Throws exception otherwise :rtype: System.String .. code-block:: csharp public string Str { get; } .. dn:property:: ampl.Variant.Type Gets the type of this variant :rtype: Type .. code-block:: csharp public Type Type { get; }