Search Results for

    Show / Hide Table of Contents

    Class DynamicValue

    Inheritance
    object
    DynamicObject
    DynamicValue
    Implements
    IDynamicMetaObjectProvider
    IEquatable<DynamicValue>
    IConvertible
    Inherited Members
    DynamicObject.GetDynamicMemberNames()
    DynamicObject.GetMetaObject(Expression)
    DynamicObject.TryCreateInstance(CreateInstanceBinder, object[], out object)
    DynamicObject.TryDeleteIndex(DeleteIndexBinder, object[])
    DynamicObject.TryDeleteMember(DeleteMemberBinder)
    DynamicObject.TryGetIndex(GetIndexBinder, object[], out object)
    DynamicObject.TryInvoke(InvokeBinder, object[], out object)
    DynamicObject.TryInvokeMember(InvokeMemberBinder, object[], out object)
    DynamicObject.TrySetIndex(SetIndexBinder, object[], object)
    DynamicObject.TrySetMember(SetMemberBinder, object)
    DynamicObject.TryUnaryOperation(UnaryOperationBinder, out object)
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: OpenSearch.Net
    Assembly: OpenSearch.Net.dll
    Syntax
    public class DynamicValue : DynamicObject, IDynamicMetaObjectProvider, IEquatable<DynamicValue>, IConvertible

    Constructors

    | Edit this page View Source

    DynamicValue(object)

    Initializes a new instance of the DynamicValue class.

    Declaration
    public DynamicValue(object value)
    Parameters
    Type Name Description
    object value

    The value to store in the instance

    Properties

    | Edit this page View Source

    HasValue

    Gets a value indicating whether this instance has value.

    Declaration
    public bool HasValue { get; }
    Property Value
    Type Description
    bool

    true if this instance has value; otherwise, false.

    Remarks

    null is considered as not being a value.

    | Edit this page View Source

    this[int]

    Declaration
    public DynamicValue this[int i] { get; }
    Parameters
    Type Name Description
    int i
    Property Value
    Type Description
    DynamicValue
    | Edit this page View Source

    this[string]

    Declaration
    public DynamicValue this[string name] { get; }
    Parameters
    Type Name Description
    string name
    Property Value
    Type Description
    DynamicValue
    | Edit this page View Source

    NullValue

    Declaration
    public static DynamicValue NullValue { get; }
    Property Value
    Type Description
    DynamicValue
    | Edit this page View Source

    Value

    Gets the inner value

    Declaration
    public object Value { get; }
    Property Value
    Type Description
    object

    Methods

    | Edit this page View Source

    Default<T>(T)

    Returns a default value if Value is null

    Declaration
    public T Default<T>(T defaultValue = default)
    Parameters
    Type Name Description
    T defaultValue

    Optional parameter for default value, if not given it returns default of type T

    Returns
    Type Description
    T

    If value is not null, value is returned, else default value is returned

    Type Parameters
    Name Description
    T

    When no default value is supplied, required to supply the default type

    | Edit this page View Source

    Equals(DynamicValue)

    Indicates whether the current object is equal to another object of the same type.

    Declaration
    public bool Equals(DynamicValue compareValue)
    Parameters
    Type Name Description
    DynamicValue compareValue

    An DynamicValue to compare with this instance.

    Returns
    Type Description
    bool

    true if the current object is equal to the compareValue parameter; otherwise, false.

    | Edit this page View Source

    Equals(object)

    Determines whether the specified object is equal to the current object.

    Declaration
    public override bool Equals(object compareValue)
    Parameters
    Type Name Description
    object compareValue

    The object to compare with the current DynamicValue.

    Returns
    Type Description
    bool

    true if the specified object is equal to the current DynamicValue; otherwise, false.

    Overrides
    object.Equals(object)
    | Edit this page View Source

    GetHashCode()

    Serves as a hash function for a particular type.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hash code for the current instance.

    Overrides
    object.GetHashCode()
    | Edit this page View Source

    GetTypeCode()

    Returns the TypeCode for this instance.

    Declaration
    public TypeCode GetTypeCode()
    Returns
    Type Description
    TypeCode

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

    | Edit this page View Source

    Get<T>(string)

    Declaration
    public T Get<T>(string path)
    Parameters
    Type Name Description
    string path
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    SelfOrNew(object)

    Declaration
    public static DynamicValue SelfOrNew(object v)
    Parameters
    Type Name Description
    object v
    Returns
    Type Description
    DynamicValue
    | Edit this page View Source

    ToBoolean(IFormatProvider)

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

    Declaration
    public bool ToBoolean(IFormatProvider provider)
    Parameters
    Type Name Description
    IFormatProvider provider

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

    Returns
    Type Description
    bool

    A Boolean value equivalent to the value of this instance.

    | Edit this page View Source

    ToByte(IFormatProvider)

    Converts the value of this instance to an equivalent 8-bit unsigned integer using the specified culture-specific formatting information.

    Declaration
    public byte ToByte(IFormatProvider provider)
    Parameters
    Type Name Description
    IFormatProvider provider

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

    Returns
    Type Description
    byte

    An 8-bit unsigned integer equivalent to the value of this instance.

    | Edit this page View Source

    ToChar(IFormatProvider)

    Converts the value of this instance to an equivalent Unicode character using the specified culture-specific formatting information.

    Declaration
    public char ToChar(IFormatProvider provider)
    Parameters
    Type Name Description
    IFormatProvider provider

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

    Returns
    Type Description
    char

    A Unicode character equivalent to the value of this instance.

    | Edit this page View Source

    ToDateTime(IFormatProvider)

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

    Declaration
    public DateTime ToDateTime(IFormatProvider provider)
    Parameters
    Type Name Description
    IFormatProvider provider

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

    Returns
    Type Description
    DateTime

    A DateTime instance equivalent to the value of this instance.

    | Edit this page View Source

    ToDecimal(IFormatProvider)

    Converts the value of this instance to an equivalent decimal number using the specified culture-specific formatting information.

    Declaration
    public decimal ToDecimal(IFormatProvider provider)
    Parameters
    Type Name Description
    IFormatProvider provider

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

    Returns
    Type Description
    decimal

    A decimal number equivalent to the value of this instance.

    | Edit this page View Source

    ToDictionary()

    Returns the value as a dictionary if the current value represents an object. Otherwise returns null.

    Declaration
    public IDictionary<string, DynamicValue> ToDictionary()
    Returns
    Type Description
    IDictionary<string, DynamicValue>
    | Edit this page View Source

    ToDouble(IFormatProvider)

    Converts 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 provider)
    Parameters
    Type Name Description
    IFormatProvider provider

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

    Returns
    Type Description
    double

    A double-precision floating-point number equivalent to the value of this instance.

    | Edit this page View Source

    ToInt16(IFormatProvider)

    Converts the value of this instance to an equivalent 16-bit signed integer using the specified culture-specific formatting information.

    Declaration
    public short ToInt16(IFormatProvider provider)
    Parameters
    Type Name Description
    IFormatProvider provider

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

    Returns
    Type Description
    short

    An 16-bit signed integer equivalent to the value of this instance.

    | Edit this page View Source

    ToInt32(IFormatProvider)

    Converts the value of this instance to an equivalent 32-bit signed integer using the specified culture-specific formatting information.

    Declaration
    public int ToInt32(IFormatProvider provider)
    Parameters
    Type Name Description
    IFormatProvider provider

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

    Returns
    Type Description
    int

    An 32-bit signed integer equivalent to the value of this instance.

    | Edit this page View Source

    ToInt64(IFormatProvider)

    Converts the value of this instance to an equivalent 64-bit signed integer using the specified culture-specific formatting information.

    Declaration
    public long ToInt64(IFormatProvider provider)
    Parameters
    Type Name Description
    IFormatProvider provider

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

    Returns
    Type Description
    long

    An 64-bit signed integer equivalent to the value of this instance.

    | Edit this page View Source

    ToSByte(IFormatProvider)

    Converts 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 provider)
    Parameters
    Type Name Description
    IFormatProvider provider

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

    Returns
    Type Description
    sbyte

    An 8-bit signed integer equivalent to the value of this instance.

    | Edit this page View Source

    ToSingle(IFormatProvider)

    Converts 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 provider)
    Parameters
    Type Name Description
    IFormatProvider provider

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

    Returns
    Type Description
    float

    A single-precision floating-point number equivalent to the value of this instance.

    | Edit this page View Source

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    object.ToString()
    | Edit this page View Source

    ToString(IFormatProvider)

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

    Declaration
    public string ToString(IFormatProvider provider)
    Parameters
    Type Name Description
    IFormatProvider provider

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

    Returns
    Type Description
    string

    A string instance equivalent to the value of this instance.

    | Edit this page View Source

    ToType(Type, IFormatProvider)

    Converts the value of this instance to an object of the specified Type that has an equivalent value, using the specified culture-specific formatting information.

    Declaration
    public object ToType(Type conversionType, IFormatProvider provider)
    Parameters
    Type Name Description
    Type conversionType

    The Type to which the value of this instance is converted.

    IFormatProvider provider

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

    Returns
    Type Description
    object

    An object instance of type conversionType whose value is equivalent to the value of this instance.

    | Edit this page View Source

    ToUInt16(IFormatProvider)

    Converts 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 provider)
    Parameters
    Type Name Description
    IFormatProvider provider

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

    Returns
    Type Description
    ushort

    An 16-bit unsigned integer equivalent to the value of this instance.

    | Edit this page View Source

    ToUInt32(IFormatProvider)

    Converts 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 provider)
    Parameters
    Type Name Description
    IFormatProvider provider

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

    Returns
    Type Description
    uint

    An 32-bit unsigned integer equivalent to the value of this instance.

    | Edit this page View Source

    ToUInt64(IFormatProvider)

    Converts 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 provider)
    Parameters
    Type Name Description
    IFormatProvider provider

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

    Returns
    Type Description
    ulong

    An 64-bit unsigned integer equivalent to the value of this instance.

    | Edit this page View Source

    TryBinaryOperation(BinaryOperationBinder, object, out object)

    Provides implementation for binary operations. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for operations such as addition and multiplication.

    Declaration
    public override bool TryBinaryOperation(BinaryOperationBinder binder, object arg, out object result)
    Parameters
    Type Name Description
    BinaryOperationBinder binder

    Provides information about the binary operation. The binder.Operation property returns an ExpressionType object. For example, for the sum = first + second statement, where first and second are derived from the DynamicObject class, binder.Operation returns ExpressionType.Add.

    object arg

    The right operand for the binary operation. For example, for the sum = first + second statement, where first and second are derived from the DynamicObject class, arg is equal to second.

    object result

    The result of the binary operation.

    Returns
    Type Description
    bool

    true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)

    Overrides
    DynamicObject.TryBinaryOperation(BinaryOperationBinder, object, out object)
    | Edit this page View Source

    TryConvert(ConvertBinder, out object)

    Provides implementation for type conversion operations. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for operations that convert an object from one type to another.

    Declaration
    public override bool TryConvert(ConvertBinder binder, out object result)
    Parameters
    Type Name Description
    ConvertBinder binder

    Provides information about the conversion operation. The binder.Type property provides the type to which the object must be converted. For example, for the statement (String)sampleObject in C# (CType(sampleObject, Type) in Visual Basic), where sampleObject is an instance of the class derived from the DynamicObject class, binder.Type returns the string type. The binder.Explicit property provides information about the kind of conversion that occurs. It returns true for explicit conversion and false for implicit conversion.

    object result

    The result of the type conversion operation.

    Returns
    Type Description
    bool

    true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)

    Overrides
    DynamicObject.TryConvert(ConvertBinder, out object)
    | Edit this page View Source

    TryGetMember(GetMemberBinder, out object)

    Declaration
    public override bool TryGetMember(GetMemberBinder binder, out object result)
    Parameters
    Type Name Description
    GetMemberBinder binder
    object result
    Returns
    Type Description
    bool
    Overrides
    DynamicObject.TryGetMember(GetMemberBinder, out object)
    | Edit this page View Source

    TryParse<T>(T)

    Attempts to convert the value to type of T, failing to do so will return the defaultValue.

    Declaration
    public T TryParse<T>(T defaultValue = default)
    Parameters
    Type Name Description
    T defaultValue

    Optional parameter for default value, if not given it returns default of type T

    Returns
    Type Description
    T

    If value is not null, value is returned, else default value is returned

    Type Parameters
    Name Description
    T

    When no default value is supplied, required to supply the default type

    Operators

    | Edit this page View Source

    operator ==(DynamicValue, object)

    Declaration
    public static bool operator ==(DynamicValue dynamicValue, object compareValue)
    Parameters
    Type Name Description
    DynamicValue dynamicValue
    object compareValue
    Returns
    Type Description
    bool
    | Edit this page View Source

    implicit operator bool(DynamicValue)

    Declaration
    public static implicit operator bool(DynamicValue dynamicValue)
    Parameters
    Type Name Description
    DynamicValue dynamicValue
    Returns
    Type Description
    bool
    | Edit this page View Source

    implicit operator DateTime(DynamicValue)

    Declaration
    public static implicit operator DateTime(DynamicValue dynamicValue)
    Parameters
    Type Name Description
    DynamicValue dynamicValue
    Returns
    Type Description
    DateTime
    | Edit this page View Source

    implicit operator decimal(DynamicValue)

    Declaration
    public static implicit operator decimal(DynamicValue dynamicValue)
    Parameters
    Type Name Description
    DynamicValue dynamicValue
    Returns
    Type Description
    decimal
    | Edit this page View Source

    implicit operator double(DynamicValue)

    Declaration
    public static implicit operator double(DynamicValue dynamicValue)
    Parameters
    Type Name Description
    DynamicValue dynamicValue
    Returns
    Type Description
    double
    | Edit this page View Source

    implicit operator Guid(DynamicValue)

    Declaration
    public static implicit operator Guid(DynamicValue dynamicValue)
    Parameters
    Type Name Description
    DynamicValue dynamicValue
    Returns
    Type Description
    Guid
    | Edit this page View Source

    implicit operator int(DynamicValue)

    Declaration
    public static implicit operator int(DynamicValue dynamicValue)
    Parameters
    Type Name Description
    DynamicValue dynamicValue
    Returns
    Type Description
    int
    | Edit this page View Source

    implicit operator long(DynamicValue)

    Declaration
    public static implicit operator long(DynamicValue dynamicValue)
    Parameters
    Type Name Description
    DynamicValue dynamicValue
    Returns
    Type Description
    long
    | Edit this page View Source

    implicit operator float(DynamicValue)

    Declaration
    public static implicit operator float(DynamicValue dynamicValue)
    Parameters
    Type Name Description
    DynamicValue dynamicValue
    Returns
    Type Description
    float
    | Edit this page View Source

    implicit operator string(DynamicValue)

    Declaration
    public static implicit operator string(DynamicValue dynamicValue)
    Parameters
    Type Name Description
    DynamicValue dynamicValue
    Returns
    Type Description
    string
    | Edit this page View Source

    implicit operator TimeSpan(DynamicValue)

    Declaration
    public static implicit operator TimeSpan(DynamicValue dynamicValue)
    Parameters
    Type Name Description
    DynamicValue dynamicValue
    Returns
    Type Description
    TimeSpan
    | Edit this page View Source

    operator !=(DynamicValue, object)

    Declaration
    public static bool operator !=(DynamicValue dynamicValue, object compareValue)
    Parameters
    Type Name Description
    DynamicValue dynamicValue
    object compareValue
    Returns
    Type Description
    bool

    Implements

    IDynamicMetaObjectProvider
    IEquatable<T>
    IConvertible

    Extension Methods

    SuffixExtensions.Suffix(object, string)
    • Edit this page
    • View Source
    In this article
    • Constructors
      • DynamicValue(object)
    • Properties
      • HasValue
      • this[int]
      • this[string]
      • NullValue
      • Value
    • Methods
      • Default<T>(T)
      • Equals(DynamicValue)
      • Equals(object)
      • GetHashCode()
      • GetTypeCode()
      • Get<T>(string)
      • SelfOrNew(object)
      • ToBoolean(IFormatProvider)
      • ToByte(IFormatProvider)
      • ToChar(IFormatProvider)
      • ToDateTime(IFormatProvider)
      • ToDecimal(IFormatProvider)
      • ToDictionary()
      • ToDouble(IFormatProvider)
      • ToInt16(IFormatProvider)
      • ToInt32(IFormatProvider)
      • ToInt64(IFormatProvider)
      • ToSByte(IFormatProvider)
      • ToSingle(IFormatProvider)
      • ToString()
      • ToString(IFormatProvider)
      • ToType(Type, IFormatProvider)
      • ToUInt16(IFormatProvider)
      • ToUInt32(IFormatProvider)
      • ToUInt64(IFormatProvider)
      • TryBinaryOperation(BinaryOperationBinder, object, out object)
      • TryConvert(ConvertBinder, out object)
      • TryGetMember(GetMemberBinder, out object)
      • TryParse<T>(T)
    • Operators
      • operator ==(DynamicValue, object)
      • implicit operator bool(DynamicValue)
      • implicit operator DateTime(DynamicValue)
      • implicit operator decimal(DynamicValue)
      • implicit operator double(DynamicValue)
      • implicit operator Guid(DynamicValue)
      • implicit operator int(DynamicValue)
      • implicit operator long(DynamicValue)
      • implicit operator float(DynamicValue)
      • implicit operator string(DynamicValue)
      • implicit operator TimeSpan(DynamicValue)
      • operator !=(DynamicValue, object)
    • Implements
    • Extension Methods
    Back to top Generated by DocFX