Show / Hide Table of Contents

Struct Variant

A strongly typed object that readily casts an intrinsic object to the other intrinsic types when possible.

Implements
System.IConvertible
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
Namespace: FastReport
Assembly: FastReport.OpenSource.dll
Syntax
public struct Variant : IConvertible
Remarks

The Variant class is an intrinsic object container structure inspired by Visual Basic 6.0's Variant. The key features of a Variant class include the ability to perform typecasts and arithmetic between types that are not normally considered compatible. For example, if a Variant class contains a string describing a number, such as "1.1", then floating point arithmetic can be performed on it.

Variants are normally considered dangerous because they strip away the effectiveness of type safety, which is the reason why the Visual Basic 6.0 Variant was left out of Visual Basic .NET. However, this implementation restores the Variant structure, both as a proof of concept and as a restoration of the utility and positive merits of the Variant where it can be used responsibly.

Constructors

Variant(Object)

Creates a strongly typed object that readily casts a primitive object to the other primitive types when possible.

Declaration
public Variant(object value)
Parameters
Type Name Description
System.Object value

Properties

ImplementsIConvertible

Returns true if the Value property implements System.IConvertible

Declaration
public bool ImplementsIConvertible { get; }
Property Value
Type Description
System.Boolean

IsDate

Returns true if the value is a date or can be parsed into a date.

Declaration
public bool IsDate { get; }
Property Value
Type Description
System.Boolean

IsNumberable

Returns true if the Value property is a numeric intrinsic value or else can be parsed into a numeric intrinsic value.

Declaration
public bool IsNumberable { get; }
Property Value
Type Description
System.Boolean

IsNumeric

Returns true if the Value property is a numeric intrinsic value.

Declaration
public bool IsNumeric { get; }
Property Value
Type Description
System.Boolean

IsTimeSpan

Returns true if the value is a TimeSpan.

Declaration
public bool IsTimeSpan { get; }
Property Value
Type Description
System.Boolean

Type

The System.Type of the Value property.

Declaration
public Type Type { get; }
Property Value
Type Description
System.Type

Value

The actual value being stored in its original System.Type, returned as an System.Object.

Declaration
public object Value { get; }
Property Value
Type Description
System.Object

Methods

CBln(Object)

Converts an object to a boolean. For any type, if null, returns false. For Boolean: true/false. For String: "", "false", "0", etc. == false; "1", "true", etc. == true, else true. For numeric intrinsics: 0 == false, else true. For any other non-null object, returns true.

Declaration
public static bool CBln(object bln)
Parameters
Type Name Description
System.Object bln

The string to be converted

Returns
Type Description
System.Boolean

The boolean value of this string.

Equals(Object)

See System.Object.Equals(System.Object).

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean
Overrides
System.ValueType.Equals(System.Object)

GetHashCode()

See System.Object.GetHashCode().

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32
Overrides
System.ValueType.GetHashCode()

GetTypeCode()

Returns the System.TypeCode for this instance.

Declaration
public TypeCode GetTypeCode()
Returns
Type Description
System.TypeCode

The enumerated constant that is the System.TypeCode of the class or value type that implements this interface.

ToBoolean()

If Value is a System.Boolean, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent System.Boolean value.

Declaration
public bool ToBoolean()
Returns
Type Description
System.Boolean

ToBoolean(IFormatProvider)

If Value is a System.Boolean, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent System.Boolean value using the specified culture-specific formatting information.

Declaration
public bool ToBoolean(IFormatProvider formatProvider)
Parameters
Type Name Description
System.IFormatProvider formatProvider

The culture-specific formatting information.

Returns
Type Description
System.Boolean

ToByte()

If Value is a System.Byte, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent 8-bit unsigned integer.

Declaration
public byte ToByte()
Returns
Type Description
System.Byte

ToByte(IFormatProvider)

If Value is a System.Byte, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent 8-bit unsigned integer using the specified culture-specific formatting information.

Declaration
public byte ToByte(IFormatProvider formatProvider)
Parameters
Type Name Description
System.IFormatProvider formatProvider

The culture-specific formatting information.

Returns
Type Description
System.Byte

ToChar()

If Value is a System.Char, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent Unicode character.

Declaration
public char ToChar()
Returns
Type Description
System.Char

ToChar(IFormatProvider)

If Value is a System.Char, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent Unicode character using the specified culture-specific formatting information.

Declaration
public char ToChar(IFormatProvider formatProvider)
Parameters
Type Name Description
System.IFormatProvider formatProvider

The culture-specific formatting information.

Returns
Type Description
System.Char

ToDateTime()

If Value is a System.DateTime, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent DateTime.

Declaration
public DateTime ToDateTime()
Returns
Type Description
System.DateTime

ToDateTime(IFormatProvider)

If Value is a System.DateTime, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent DateTime using the specified culture-specific formatting information.

Declaration
public DateTime ToDateTime(IFormatProvider formatProvider)
Parameters
Type Name Description
System.IFormatProvider formatProvider

The culture-specific formatting information.

Returns
Type Description
System.DateTime

ToDateTimeOffset()

If Value is a System.DateTimeOffset, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent DateTimeOffset.

Declaration
public DateTimeOffset ToDateTimeOffset()
Returns
Type Description
System.DateTimeOffset

ToDateTimeOffset(IFormatProvider)

If Value is a System.DateTimeOffset, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent DateTimeOffset using the specified culture-specific formatting information.

Declaration
public DateTimeOffset ToDateTimeOffset(IFormatProvider formatProvider)
Parameters
Type Name Description
System.IFormatProvider formatProvider

The culture-specific formatting information.

Returns
Type Description
System.DateTimeOffset

ToDecimal()

If Value is a System.Decimal, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent Decimal number.

Declaration
public decimal ToDecimal()
Returns
Type Description
System.Decimal

ToDecimal(IFormatProvider)

If Value is a System.Decimal, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent Decimal number using the specified culture-specific formatting information.

Declaration
public decimal ToDecimal(IFormatProvider formatProvider)
Parameters
Type Name Description
System.IFormatProvider formatProvider

The culture-specific formatting information.

Returns
Type Description
System.Decimal

ToDouble()

If Value is a System.Double, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent double-precision floating-point number.

Declaration
public double ToDouble()
Returns
Type Description
System.Double

ToDouble(IFormatProvider)

If Value is a System.Double, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent double-precision floating-point number using the specified culture-specific formatting information.

Declaration
public double ToDouble(IFormatProvider formatProvider)
Parameters
Type Name Description
System.IFormatProvider formatProvider

The culture-specific formatting information.

Returns
Type Description
System.Double

ToInt16()

If Value is a System.Int16, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent 16-bit signed integer.

Declaration
public short ToInt16()
Returns
Type Description
System.Int16

ToInt16(IFormatProvider)

If Value is a System.Boolean, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent 16-bit signed integer using the specified culture-specific formatting information.

Declaration
public short ToInt16(IFormatProvider formatProvider)
Parameters
Type Name Description
System.IFormatProvider formatProvider

The culture-specific formatting information.

Returns
Type Description
System.Int16

ToInt32()

If Value is a System.Int32, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent 32-bit signed integer.

Declaration
public int ToInt32()
Returns
Type Description
System.Int32

ToInt32(IFormatProvider)

If Value is a System.Int32, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent 32-bit signed integer using the specified culture-specific formatting information.

Declaration
public int ToInt32(IFormatProvider formatProvider)
Parameters
Type Name Description
System.IFormatProvider formatProvider

The culture-specific formatting information.

Returns
Type Description
System.Int32

ToInt64()

If Value is a System.Int64, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent 64-bit signed integer.

Declaration
public long ToInt64()
Returns
Type Description
System.Int64

ToInt64(IFormatProvider)

If Value is a System.Int64, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent 64-bit signed integer using the specified culture-specific formatting information.

Declaration
public long ToInt64(IFormatProvider formatProvider)
Parameters
Type Name Description
System.IFormatProvider formatProvider

The culture-specific formatting information.

Returns
Type Description
System.Int64

ToSByte()

If Value is a System.SByte, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent 8-bit signed integer.

Declaration
[CLSCompliant(false)]
public sbyte ToSByte()
Returns
Type Description
System.SByte

ToSByte(IFormatProvider)

If Value is a System.SByte, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent 8-bit signed integer using the specified culture-specific formatting information.

Declaration
[CLSCompliant(false)]
public sbyte ToSByte(IFormatProvider formatProvider)
Parameters
Type Name Description
System.IFormatProvider formatProvider

The culture-specific formatting information.

Returns
Type Description
System.SByte

ToSingle()

If Value is a System.Single, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent single-precision floating-point number.

Declaration
public float ToSingle()
Returns
Type Description
System.Single

ToSingle(IFormatProvider)

If Value is a System.Single, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent single-precision floating-point number using the specified culture-specific formatting information.

Declaration
public float ToSingle(IFormatProvider formatProvider)
Parameters
Type Name Description
System.IFormatProvider formatProvider

The culture-specific formatting information.

Returns
Type Description
System.Single

ToString()

Returns FastReport.Variant.String property unless the value on the right is null. If the value on the right is null, returns "".

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
System.ValueType.ToString()

ToString(IFormatProvider)

Converts the value of this instance to an equivalent FastReport.Variant.String using the specified culture-specific formatting information.

Declaration
public string ToString(IFormatProvider formatProvider)
Parameters
Type Name Description
System.IFormatProvider formatProvider
Returns
Type Description
System.String

ToTimeSpan()

If Value is a System.TimeSpan, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent TimeSpan.

Declaration
public TimeSpan ToTimeSpan()
Returns
Type Description
System.TimeSpan

ToTimeSpan(IFormatProvider)

If Value is a System.TimeSpan, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent TimeSpan using the specified culture-specific formatting information.

Declaration
public TimeSpan ToTimeSpan(IFormatProvider formatProvider)
Parameters
Type Name Description
System.IFormatProvider formatProvider

The culture-specific formatting information.

Returns
Type Description
System.TimeSpan

ToType(Type)

Attempts to convert or typecast to the specified type.

Declaration
public object ToType(Type type)
Parameters
Type Name Description
System.Type type

The type to convert or cast to.

Returns
Type Description
System.Object

The object after typecasting.

ToType(Type, IFormatProvider)

Attempts to convert or typecast to the specified type.

Declaration
public object ToType(Type type, IFormatProvider provider)
Parameters
Type Name Description
System.Type type

The type to convert or cast to.

System.IFormatProvider provider

An System.IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns
Type Description
System.Object

The object after typecasting.

ToUInt16()

If Value is a System.UInt16, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent 16-bit unsigned integer.

Declaration
[CLSCompliant(false)]
public ushort ToUInt16()
Returns
Type Description
System.UInt16

ToUInt16(IFormatProvider)

If Value is a System.UInt16, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent 16-bit unsigned integer using the specified culture-specific formatting information.

Declaration
[CLSCompliant(false)]
public ushort ToUInt16(IFormatProvider formatProvider)
Parameters
Type Name Description
System.IFormatProvider formatProvider

The culture-specific formatting information.

Returns
Type Description
System.UInt16

ToUInt32()

If Value is a System.UInt32, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent 32-bit unsigned integer.

Declaration
[CLSCompliant(false)]
public uint ToUInt32()
Returns
Type Description
System.UInt32

ToUInt32(IFormatProvider)

If Value is a System.UInt32, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent 32-bit unsigned integer using the specified culture-specific formatting information.

Declaration
[CLSCompliant(false)]
public uint ToUInt32(IFormatProvider formatProvider)
Parameters
Type Name Description
System.IFormatProvider formatProvider

The culture-specific formatting information.

Returns
Type Description
System.UInt32

ToUInt64()

If Value is a System.UInt64, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent 64-bit unsigned integer.

Declaration
[CLSCompliant(false)]
public ulong ToUInt64()
Returns
Type Description
System.UInt64

ToUInt64(IFormatProvider)

If Value is a System.UInt64, returns as-is. Otherwise, attempts to convert the value of this instance to an equivalent 64-bit unsigned integer using the specified culture-specific formatting information.

Declaration
[CLSCompliant(false)]
public ulong ToUInt64(IFormatProvider formatProvider)
Parameters
Type Name Description
System.IFormatProvider formatProvider

The culture-specific formatting information.

Returns
Type Description
System.UInt64

Operators

Addition(Variant, Object)

Addition operator.

Declaration
public static Variant operator +(Variant subjectVariant, object value)
Parameters
Type Name Description
Variant subjectVariant
System.Object value
Returns
Type Description
Variant

A new Variant containing the resulting value.

Remarks

If the value on the right is a System.String or a System.Char, the Variant is converted to a string and appended. If the value on the right or the Variant is a System.DateTime, arithmetic is performed on the System.DateTime.Ticks property and the resulting value is set to the DateTime type. Otherwise, if the value on the right is a number, both the Variant and the value on the right are converted to a System.Double, the arithmetic is performed, and the resulting value is converted back to the original type that the Variant previously represented. If the type that the Variant previously represented cannot contain the resulting value--such as if the type is a System.UInt32 and the value is -12--then the type will be converted to a type that can contain the value, such as System.Int32.

BitwiseAnd(Variant, Object)

Bitwise And operator.

Declaration
public static Variant operator &(Variant subjectVariant, object value)
Parameters
Type Name Description
Variant subjectVariant
System.Object value
Returns
Type Description
Variant

A new Variant containing the resulting value.

Remarks

If the value on the right or the Variant is a System.DateTime, arithmetic is performed on the System.DateTime.Ticks property and the resulting value is set to the DateTime type. Otherwise, if the value on the right is a number, both the Variant and the value on the right are converted to a System.Double, the arithmetic is performed, and the resulting value is converted back to the original type that the Variant previously represented. If the type that the Variant previously represented cannot contain the resulting value--such as if the type is a System.UInt32 and the value is -12--then the type will be converted to a type that can contain the value, such as System.Int32.

BitwiseOr(Variant, Object)

Bitwise Or operator.

Declaration
public static Variant operator |(Variant subjectVariant, object value)
Parameters
Type Name Description
Variant subjectVariant
System.Object value
Returns
Type Description
Variant

A new Variant containing the resulting value.

Remarks

If the value on the right or the Variant is a System.DateTime, arithmetic is performed on the System.DateTime.Ticks property and the resulting value is set to the DateTime type. Otherwise, if the value on the right is a number, both the Variant and the value on the right are converted to a System.Double, the arithmetic is performed, and the resulting value is converted back to the original type that the Variant previously represented. If the type that the Variant previously represented cannot contain the resulting value--such as if the type is a System.UInt32 and the value is -12--then the type will be converted to a type that can contain the value, such as System.Int32.

Division(Variant, Object)

Division operator.

Declaration
public static Variant operator /(Variant subjectVariant, object value)
Parameters
Type Name Description
Variant subjectVariant
System.Object value
Returns
Type Description
Variant

A new Variant containing the resulting value.

Remarks

If the value on the right or the Variant is a System.DateTime, arithmetic is performed on the System.DateTime.Ticks property and the resulting value is set to the DateTime type. Otherwise, if the value on the right is a number, both the Variant and the value on the right are converted to a System.Double, the arithmetic is performed, and the resulting value is converted back to the original type that the Variant previously represented. If the type that the Variant previously represented cannot contain the resulting value--such as if the type is a System.UInt32 and the value is -12--then the type will be converted to a type that can contain the value, such as System.Int32.

Equality(Variant, Object)

Equality operator.

First attempts to compare the left value after temporarily converting it to the type of the right value. If the conversion cannot occur, such as if the value is not an intrinsic value type, the comparison occurs at the System.Object level using Object.Equals.

Declaration
public static bool operator ==(Variant subjectVariant, object value)
Parameters
Type Name Description
Variant subjectVariant
System.Object value
Returns
Type Description
System.Boolean

Equality(Variant, String)

Equality operator.

Declaration
public static bool operator ==(Variant subjectVariant, string value)
Parameters
Type Name Description
Variant subjectVariant
System.String value
Returns
Type Description
System.Boolean

GreaterThan(Variant, Object)

Greater than operator.

Declaration
public static bool operator>(Variant subjectVariant, object value)
Parameters
Type Name Description
Variant subjectVariant
System.Object value
Returns
Type Description
System.Boolean

GreaterThanOrEqual(Variant, Object)

Greater than or equal operator.

Declaration
public static bool operator >=(Variant subjectVariant, object value)
Parameters
Type Name Description
Variant subjectVariant
System.Object value
Returns
Type Description
System.Boolean

Implicit(Variant to Boolean)

Declaration
public static implicit operator bool (Variant v)
Parameters
Type Name Description
Variant v
Returns
Type Description
System.Boolean

Implicit(Variant to Byte)

Declaration
public static implicit operator byte (Variant v)
Parameters
Type Name Description
Variant v
Returns
Type Description
System.Byte

Implicit(Variant to Char)

Declaration
public static implicit operator char (Variant v)
Parameters
Type Name Description
Variant v
Returns
Type Description
System.Char

Implicit(Variant to DateTime)

Declaration
public static implicit operator DateTime(Variant v)
Parameters
Type Name Description
Variant v
Returns
Type Description
System.DateTime

Implicit(Variant to Decimal)

Declaration
public static implicit operator decimal (Variant v)
Parameters
Type Name Description
Variant v
Returns
Type Description
System.Decimal

Implicit(Variant to Double)

Declaration
public static implicit operator double (Variant v)
Parameters
Type Name Description
Variant v
Returns
Type Description
System.Double

Implicit(Variant to Int16)

Declaration
public static implicit operator short (Variant v)
Parameters
Type Name Description
Variant v
Returns
Type Description
System.Int16

Implicit(Variant to Int32)

Declaration
public static implicit operator int (Variant v)
Parameters
Type Name Description
Variant v
Returns
Type Description
System.Int32

Implicit(Variant to Int64)

Declaration
public static implicit operator long (Variant v)
Parameters
Type Name Description
Variant v
Returns
Type Description
System.Int64

Implicit(Variant to SByte)

Declaration
[CLSCompliant(false)]
public static implicit operator sbyte (Variant v)
Parameters
Type Name Description
Variant v
Returns
Type Description
System.SByte

Implicit(Variant to Single)

Declaration
public static implicit operator float (Variant v)
Parameters
Type Name Description
Variant v
Returns
Type Description
System.Single

Implicit(Variant to String)

Declaration
public static implicit operator string (Variant v)
Parameters
Type Name Description
Variant v
Returns
Type Description
System.String

Implicit(Variant to TimeSpan)

Declaration
public static implicit operator TimeSpan(Variant v)
Parameters
Type Name Description
Variant v
Returns
Type Description
System.TimeSpan

Implicit(Variant to UInt16)

Declaration
[CLSCompliant(false)]
public static implicit operator ushort (Variant v)
Parameters
Type Name Description
Variant v
Returns
Type Description
System.UInt16

Implicit(Variant to UInt32)

Declaration
[CLSCompliant(false)]
public static implicit operator uint (Variant v)
Parameters
Type Name Description
Variant v
Returns
Type Description
System.UInt32

Implicit(Variant to UInt64)

Declaration
[CLSCompliant(false)]
public static implicit operator ulong (Variant v)
Parameters
Type Name Description
Variant v
Returns
Type Description
System.UInt64

Implicit(Boolean to Variant)

Declaration
public static implicit operator Variant(bool v)
Parameters
Type Name Description
System.Boolean v
Returns
Type Description
Variant

Implicit(Byte to Variant)

Declaration
public static implicit operator Variant(byte v)
Parameters
Type Name Description
System.Byte v
Returns
Type Description
Variant

Implicit(Char to Variant)

Declaration
public static implicit operator Variant(char v)
Parameters
Type Name Description
System.Char v
Returns
Type Description
Variant

Implicit(DateTime to Variant)

Declaration
public static implicit operator Variant(DateTime v)
Parameters
Type Name Description
System.DateTime v
Returns
Type Description
Variant

Implicit(Decimal to Variant)

Declaration
public static implicit operator Variant(decimal v)
Parameters
Type Name Description
System.Decimal v
Returns
Type Description
Variant

Implicit(Double to Variant)

Declaration
public static implicit operator Variant(double v)
Parameters
Type Name Description
System.Double v
Returns
Type Description
Variant

Implicit(Int16 to Variant)

Declaration
public static implicit operator Variant(short v)
Parameters
Type Name Description
System.Int16 v
Returns
Type Description
Variant

Implicit(Int32 to Variant)

Declaration
public static implicit operator Variant(int v)
Parameters
Type Name Description
System.Int32 v
Returns
Type Description
Variant

Implicit(Int64 to Variant)

Declaration
public static implicit operator Variant(long v)
Parameters
Type Name Description
System.Int64 v
Returns
Type Description
Variant

Implicit(SByte to Variant)

Declaration
[CLSCompliant(false)]
public static implicit operator Variant(sbyte v)
Parameters
Type Name Description
System.SByte v
Returns
Type Description
Variant

Implicit(Single to Variant)

Declaration
public static implicit operator Variant(float v)
Parameters
Type Name Description
System.Single v
Returns
Type Description
Variant

Implicit(String to Variant)

Declaration
public static implicit operator Variant(string v)
Parameters
Type Name Description
System.String v
Returns
Type Description
Variant

Implicit(TimeSpan to Variant)

Declaration
public static implicit operator Variant(TimeSpan v)
Parameters
Type Name Description
System.TimeSpan v
Returns
Type Description
Variant

Implicit(UInt16 to Variant)

Declaration
[CLSCompliant(false)]
public static implicit operator Variant(ushort v)
Parameters
Type Name Description
System.UInt16 v
Returns
Type Description
Variant

Implicit(UInt32 to Variant)

Declaration
[CLSCompliant(false)]
public static implicit operator Variant(uint v)
Parameters
Type Name Description
System.UInt32 v
Returns
Type Description
Variant

Implicit(UInt64 to Variant)

Declaration
[CLSCompliant(false)]
public static implicit operator Variant(ulong v)
Parameters
Type Name Description
System.UInt64 v
Returns
Type Description
Variant

Inequality(Variant, Object)

Inequality operator.

Declaration
public static bool operator !=(Variant subjectVariant, object value)
Parameters
Type Name Description
Variant subjectVariant
System.Object value
Returns
Type Description
System.Boolean

The opposite of ==

Inequality(Variant, String)

Equality operator.

Declaration
public static bool operator !=(Variant subjectVariant, string value)
Parameters
Type Name Description
Variant subjectVariant
System.String value
Returns
Type Description
System.Boolean

LessThan(Variant, Object)

Less than operator.

Declaration
public static bool operator <(Variant subjectVariant, object value)
Parameters
Type Name Description
Variant subjectVariant
System.Object value
Returns
Type Description
System.Boolean

LessThanOrEqual(Variant, Object)

Less than or equal operator.

Declaration
public static bool operator <=(Variant subjectVariant, object value)
Parameters
Type Name Description
Variant subjectVariant
System.Object value
Returns
Type Description
System.Boolean

Modulus(Variant, Object)

Modulus operator.

Declaration
public static Variant operator %(Variant subjectVariant, object value)
Parameters
Type Name Description
Variant subjectVariant
System.Object value
Returns
Type Description
Variant

A new Variant containing the resulting value.

Remarks

If the value on the right or the Variant is a System.DateTime, arithmetic is performed on the System.DateTime.Ticks property and the resulting value is set to the DateTime type. Otherwise, if the value on the right is a number, both the Variant and the value on the right are converted to a System.Double, the arithmetic is performed, and the resulting value is converted back to the original type that the Variant previously represented. If the type that the Variant previously represented cannot contain the resulting value--such as if the type is a System.UInt32 and the value is -12--then the type will be converted to a type that can contain the value, such as System.Int32.

Multiply(Variant, Object)

Multiplication operator.

Declaration
public static Variant operator *(Variant subjectVariant, object value)
Parameters
Type Name Description
Variant subjectVariant
System.Object value
Returns
Type Description
Variant

A new Variant containing the resulting value.

Remarks

If the value on the right or the Variant is a System.DateTime, arithmetic is performed on the System.DateTime.Ticks property and the resulting value is set to the DateTime type. Otherwise, if the value on the right is a number, both the Variant and the value on the right are converted to a System.Double, the arithmetic is performed, and the resulting value is converted back to the original type that the Variant previously represented. If the type that the Variant previously represented cannot contain the resulting value--such as if the type is a System.UInt32 and the value is -12--then the type will be converted to a type that can contain the value, such as System.Int32.

Subtraction(Variant, Object)

Subtraction operator.

Declaration
public static Variant operator -(Variant subjectVariant, object value)
Parameters
Type Name Description
Variant subjectVariant
System.Object value
Returns
Type Description
Variant

A new Variant containing the resulting value.

Remarks

If the value on the right or the Variant is a System.DateTime, arithmetic is performed on the System.DateTime.Ticks property and the resulting value is set to the DateTime type. Otherwise, if the value on the right is a number, both the Variant and the value on the right are converted to a System.Double, the arithmetic is performed, and the resulting value is converted back to the original type that the Variant previously represented. If the type that the Variant previously represented cannot contain the resulting value--such as if the type is a System.UInt32 and the value is -12--then the type will be converted to a type that can contain the value, such as System.Int32.

UnaryNegation(Variant)

Unary minus operator.

Declaration
public static Variant operator -(Variant subjectVariant)
Parameters
Type Name Description
Variant subjectVariant
Returns
Type Description
Variant

Implements

System.IConvertible
Back to top Generated by DocFX