Struct EnumOrRawValue<TEnum>
Wrapper for glTF string properties that the specification has a limited set of valid values for. If the value is unknown (may have been introduced by a glTF extension), Value will have the default value and RawValue will hold the original UTF-8 encoded string value.
Inherited Members
Namespace: Unity.Cloud.Gltfast.Objects
Assembly: Unity.Cloud.Gltfast.dll
Syntax
public readonly struct EnumOrRawValue<TEnum> : IEquatable<TEnum>, IEquatable<EnumOrRawValue<TEnum>> where TEnum : struct, Enum
Type Parameters
| Name | Description |
|---|---|
| TEnum | Enum type the string is deserialized to. |
Constructors
EnumOrRawValue(byte[])
Construct from UTF-8 string value.
Declaration
public EnumOrRawValue(byte[] rawValue)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | rawValue | UTF-8 string value |
EnumOrRawValue(TEnum)
Construct from enum value.
Declaration
public EnumOrRawValue(TEnum value)
Parameters
| Type | Name | Description |
|---|---|---|
| TEnum | value | Enum value |
Properties
RawValue
UTF-8 encoded raw string value
Declaration
public byte[] RawValue { get; }
Property Value
| Type | Description |
|---|---|
| byte[] |
Value
Enum value
Declaration
public TEnum Value { get; }
Property Value
| Type | Description |
|---|---|
| TEnum |
Methods
Equals(object)
Indicates whether the current instance is equal to the given object.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | Object to compare with this instance. |
Returns
| Type | Description |
|---|---|
| bool | True if |
Overrides
Equals(EnumOrRawValue<TEnum>)
Indicates whether the current instance is equal to another instance of the same type.
Declaration
public bool Equals(EnumOrRawValue<TEnum> other)
Parameters
| Type | Name | Description |
|---|---|---|
| EnumOrRawValue<TEnum> | other | An instance to compare with this instance. |
Returns
| Type | Description |
|---|---|
| bool | True if both instances have equal Value and RawValue; false otherwise. |
Equals(TEnum)
Indicates whether this instance represents the given enum value.
Declaration
public bool Equals(TEnum other)
Parameters
| Type | Name | Description |
|---|---|---|
| TEnum | other | Enum value to compare with this instance's Value. |
Returns
| Type | Description |
|---|---|
| bool | True if RawValue is null and Value equals |
GetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int |
Overrides
ToString()
Returns a string representation of this instance.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | The UTF-8 decoded RawValue when set; otherwise Value's string representation. |
Overrides
Operators
operator ==(EnumOrRawValue<TEnum>, TEnum)
Equality operator comparing an EnumOrRawValue<TEnum> to an enum value.
Declaration
public static bool operator ==(EnumOrRawValue<TEnum> lhs, TEnum rhs)
Parameters
| Type | Name | Description |
|---|---|---|
| EnumOrRawValue<TEnum> | lhs | Left-hand side instance. |
| TEnum | rhs | Right-hand side enum value. |
Returns
| Type | Description |
|---|---|
| bool | True if |
implicit operator EnumOrRawValue<TEnum>(TEnum)
Implicit conversion from an enum value, so call sites can assign a bare enum to a wrapped property.
Declaration
public static implicit operator EnumOrRawValue<TEnum>(TEnum value)
Parameters
| Type | Name | Description |
|---|---|---|
| TEnum | value | Enum value to wrap. |
Returns
| Type | Description |
|---|---|
| EnumOrRawValue<TEnum> | EnumOrRawValue<TEnum> wrapper around enum value. |
operator !=(EnumOrRawValue<TEnum>, TEnum)
Inequality operator comparing an EnumOrRawValue<TEnum> to an enum value.
Declaration
public static bool operator !=(EnumOrRawValue<TEnum> lhs, TEnum rhs)
Parameters
| Type | Name | Description |
|---|---|---|
| EnumOrRawValue<TEnum> | lhs | Left-hand side instance. |
| TEnum | rhs | Right-hand side enum value. |
Returns
| Type | Description |
|---|---|
| bool | True if |