GH_Variant

References
public class GH_Variant
Variant data used in Grasshopper Expressions.

Constructors

GH_Variant

#
Create a new Null variant.
public GH_Variant()

GH_Variant

#
Create a new Bool variant.
public GH_Variant(
value
Value of Variant.
)

GH_Variant

#
Create a new Complex variant.
public GH_Variant(
value
Value of Variant.
)

GH_Variant

#
Create a new Double variant.
public GH_Variant(
value
Value of Variant.
)

GH_Variant

#
Duplicate a Variant.
public GH_Variant(
GH_Variant
other
Variant to duplicate
)

GH_Variant

#
Create a new Integer variant.
public GH_Variant(
value
Value of Variant.
)

GH_Variant

#
Create a new Plane variant.
public GH_Variant(
value
Value of Variant.
)

GH_Variant

#
Create a new Point variant.
public GH_Variant(
value
Value of Variant.
)

GH_Variant

#
Create a new String variant.
public GH_Variant(
value
Value of Variant.
)

GH_Variant

#
Create a new Point variant.
public GH_Variant(
value
Value of Variant.
)

Properties

_Bool

#
Gets the contents of this Variant as a bool.
public bool _Bool { get; }

_Complex

#
Gets the contents of this Variant as a complex number.
public Complex _Complex { get; }

_Double

#
Gets the contents of this Variant as a double. If the Variant is of type Integer this cast will also work.
public double _Double { get; }

_Int

#
Gets the contents of this Variant as an integer.
public int _Int { get; }

_Plane

#
Gets the contents of this Variant as a Plane.
public Plane _Plane { get; }

_Point

#
Gets the contents of this Variant as a Point.
public Point3d _Point { get; }

_String

#
Gets the contents of this Variant as a String. This function will work for all Variant types.
public string _String { get; }

_Vector

#
Gets the contents of this Variant as a Vector.
public Vector3d _Vector { get; }

IsNumeric

#
Gets a value indicating whether or not the Variant is a numeric type. Only Doubles and Integers are considered to be Numeric.
public bool IsNumeric { get; }

Type

#
Gets the Type of this Variant.
public GH_VariantType Type { get; }

Methods

Data<T>

#
Perform a straight cast of the data inside this Variant.
public T Data<T>()
The value inside this Variant cast to T.

Duplicate

#
Duplicate this Variant. If the type of this Variant is [unknown] the contents are not guaranteed to be duplicated.
public GH_Variant Duplicate()

Evaluate

#
If this variant represents a string, this function will attempt to evaluate that string and replace the data inside this variant.
public bool Evaluate()
True if the string was evaluated, false if otherwise.

ToGoo

#
Attempt to convert a Variant to a Grasshopper IGH_Goo type.
public IGH_Goo ToGoo()
An instance of a class implementing IGH_Goo or null.

ToString

#
public override string ToString()
Object.ToString