Pip-Services-Commons-Dotnet
|
Cross-language implementation of dynamic object array what can hold values of any type. The stored values can be converted to different types using variety of accessor methods. More...
Public Member Functions | |
AnyValueArray () | |
Creates a new instance of the array. More... | |
AnyValueArray (object[] values) | |
Creates a new instance of the array and assigns its value. More... | |
AnyValueArray (IEnumerable values) | |
Creates a new instance of the array and assigns its value. More... | |
virtual object | Get (int index) |
Gets an array element specified by its index. More... | |
virtual void | Set (int index, object value) |
Sets a new value into array element specified by its index. More... | |
object | GetAsObject () |
Gets the value stored in this array element without any conversions More... | |
void | SetAsObject (object value) |
Sets a new value for this array element More... | |
void | Append (object[] values) |
Appends new elements to this array. More... | |
void | Append (IEnumerable values) |
Appends new elements to this array. More... | |
object | GetAsObject (int index) |
Gets an array element specified by its index. More... | |
void | SetAsObject (int index, object value) |
Sets a new value into array element specified by its index. More... | |
string | GetAsNullableString (int index) |
Converts array element into a string or returns null if conversion is not possible. More... | |
string | GetAsString (int index) |
Converts array element into a string or returns "" if conversion is not possible. More... | |
string | GetAsStringWithDefault (int index, string defaultValue) |
Converts array element into a string or returns default value if conversion is not possible. More... | |
bool | GetAsNullableBoolean (int index) |
Converts array element into a boolean or returns null if conversion is not possible. More... | |
bool | GetAsBoolean (int index) |
Converts array element into a boolean or returns false if conversion is not possible. More... | |
bool | GetAsBooleanWithDefault (int index, bool defaultValue) |
Converts array element into a boolean or returns default value if conversion is not possible. More... | |
int | GetAsNullableInteger (int index) |
Converts array element into an integer or returns null if conversion is not possible. More... | |
int | GetAsInteger (int index) |
Converts array element into an integer or returns 0 if conversion is not possible. More... | |
int | GetAsIntegerWithDefault (int index, int defaultValue) |
Converts array element into an integer or returns default value if conversion is not possible. More... | |
long | GetAsNullableLong (int index) |
Converts array element into a long or returns null if conversion is not possible. More... | |
long | GetAsLong (int index) |
Converts array element into a long or returns 0 if conversion is not possible. More... | |
long | GetAsLongWithDefault (int index, long defaultValue) |
Converts array element into a long or returns default value if conversion is not possible. More... | |
float | GetAsNullableFloat (int index) |
Converts array element into a float or returns null if conversion is not possible. More... | |
float | GetAsFloat (int index) |
Converts array element into a float or returns 0 if conversion is not possible. More... | |
float | GetAsFloatWithDefault (int index, float defaultValue) |
Converts array element into a float or returns default value if conversion is not possible. More... | |
double | GetAsNullableDouble (int index) |
Converts array element into a double or returns null if conversion is not possible. More... | |
double | GetAsDouble (int index) |
Converts array element into a double or returns 0 if conversion is not possible. More... | |
double | GetAsDoubleWithDefault (int index, double defaultValue) |
Converts array element into a double or returns default value if conversion is not possible. More... | |
DateTime | GetAsNullableDateTime (int index) |
Converts array element into a Date or returns null if conversion is not possible. More... | |
DateTime | GetAsDateTime (int index) |
Converts array element into a Date or returns current date if conversion is not possible. More... | |
DateTime | GetAsDateTimeWithDefault (int index, DateTime? defaultValue) |
Converts array element into a Date or returns default value if conversion is not possible. More... | |
TimeSpan | GetAsNullableTimeSpan (int index) |
TimeSpan | GetAsTimeSpan (int index) |
TimeSpan | GetAsTimeSpanWithDefault (int index, TimeSpan? defaultValue) |
T | GetAsNullableEnum< T > (int index) |
T | GetAsEnum< T > (int index) |
T | GetAsEnumWithDefault< T > (int index, T defaultValue) |
T | GetATypes< T > (int index) |
Converts array element into a value defined by specied typecode. If conversion is not possible it returns default value for the specified type.. More... | |
T | GetAsNullableType< T > (int index) |
Converts array element into a value defined by specied typecode. If conversion is not possible it returns null. More... | |
T | GetAsNullableTypeWithDefault< T > (int index, T defaultValue) |
Converts array element into a value defined by specied typecode. If conversion is not possible it returns default value. More... | |
AnyValue | GetAsValue (int index) |
Converts array element into an AnyValue or returns an empty AnyValue if conversion is not possible. More... | |
AnyValueArray | GetAsNullableArray (int index) |
Converts array element into an AnyValueArray or returns null if conversion is not possible. More... | |
AnyValueArray | GetAsArray (int index) |
Converts array element into an AnyValueArray or returns empty AnyValueArray if conversion is not possible. More... | |
AnyValueArray | GetAsArrayWithDefault (int index, AnyValueArray defaultValue) |
Converts array element into an AnyValueArray or returns default value if conversion is not possible. More... | |
AnyValueMap | GetAsNullableMap (int index) |
Converts array element into an AnyValueMap or returns null if conversion is not possible. More... | |
AnyValueMap | GetAsMap (int index) |
Converts array element into an AnyValueMap or returns empty AnyValueMap if conversion is not possible. More... | |
AnyValueMap | GetAsMapWithDefault (int index, AnyValueMap defaultValue) |
Converts array element into an AnyValueMap or returns default value if conversion is not possible. More... | |
new bool | Contains (object value) |
Checks if this array contains a value. The check uses direct comparison between elements and the specified value. More... | |
bool | ContainsAs< T > (object value) |
Checks if this array contains a value. The check before comparison converts elements and the value to type specified by type code. More... | |
override string | ToString () |
Gets a string representation of the object. The result is a comma-separated list of string representations of individual elements as "value1,value2,value3" More... | |
object | Clone () |
Creates a binary clone of this object. More... | |
Static Public Member Functions | |
static AnyValueArray | FromValues (params object[] values) |
Creates a new AnyValueArray from a list of values More... | |
static AnyValueArray | FromValue (object value) |
Converts specified value into AnyValueArray. More... | |
static AnyValueArray | FromString (string value, char separator, bool removeDuplicates) |
Splits specified string into elements using a separator and assigns the elements to a newly created AnyValueArray. More... | |
static AnyValueArray | FromString (string value, char separator) |
Splits specified string into elements using a separator and assigns the elements to a newly created AnyValueArray. More... | |
Cross-language implementation of dynamic object array what can hold values of any type. The stored values can be converted to different types using variety of accessor methods.
See StringConverter, BooleanConverter, IntegerConverter, LongConverter, DoubleConverter, FloatConverter, DateTimeConverter, ICloneable
PipServices3.Commons.Data.AnyValueArray.AnyValueArray | ( | ) |
Creates a new instance of the array.
PipServices3.Commons.Data.AnyValueArray.AnyValueArray | ( | object [] | values | ) |
Creates a new instance of the array and assigns its value.
values | (optional) values to initialize this array. |
PipServices3.Commons.Data.AnyValueArray.AnyValueArray | ( | IEnumerable | values | ) |
Creates a new instance of the array and assigns its value.
values | (optional) values to initialize this array. |
void PipServices3.Commons.Data.AnyValueArray.Append | ( | object [] | values | ) |
Appends new elements to this array.
values | a list of elements to be added. |
void PipServices3.Commons.Data.AnyValueArray.Append | ( | IEnumerable | values | ) |
Appends new elements to this array.
values | a list of elements to be added. |
object PipServices3.Commons.Data.AnyValueArray.Clone | ( | ) |
Creates a binary clone of this object.
Implements PipServices3.Commons.Data.ICloneable.
new bool PipServices3.Commons.Data.AnyValueArray.Contains | ( | object | value | ) |
Checks if this array contains a value. The check uses direct comparison between elements and the specified value.
value | a value to be checked |
bool PipServices3.Commons.Data.AnyValueArray.ContainsAs< T > | ( | object | value | ) |
Checks if this array contains a value. The check before comparison converts elements and the value to type specified by type code.
T | the class type |
value | a value to be checked |
See TypeConverter.ToType<T>(object)
|
static |
Splits specified string into elements using a separator and assigns the elements to a newly created AnyValueArray.
value | a string value to be split and assigned to AnyValueArray |
separator | a separator to split the string |
removeDuplicates | (optional) true to remove duplicated elements |
|
static |
Splits specified string into elements using a separator and assigns the elements to a newly created AnyValueArray.
value | a string value to be split and assigned to AnyValueArray |
separator | a separator to split the string |
|
static |
Converts specified value into AnyValueArray.
value | value to be converted |
See ArrayConverter.ToNullableArray(object)
|
static |
Creates a new AnyValueArray from a list of values
values | a list of values to initialize the created AnyValueArray |
|
virtual |
Gets an array element specified by its index.
index | an index of the element to get. |
AnyValueArray PipServices3.Commons.Data.AnyValueArray.GetAsArray | ( | int | index | ) |
Converts array element into an AnyValueArray or returns empty AnyValueArray if conversion is not possible.
index | an index of element to get. |
AnyValueArray PipServices3.Commons.Data.AnyValueArray.GetAsArrayWithDefault | ( | int | index, |
AnyValueArray | defaultValue | ||
) |
Converts array element into an AnyValueArray or returns default value if conversion is not possible.
index | an index of element to get. |
defaultValue | the default value |
bool PipServices3.Commons.Data.AnyValueArray.GetAsBoolean | ( | int | index | ) |
Converts array element into a boolean or returns false if conversion is not possible.
index | an index of element to get. |
bool PipServices3.Commons.Data.AnyValueArray.GetAsBooleanWithDefault | ( | int | index, |
bool | defaultValue | ||
) |
Converts array element into a boolean or returns default value if conversion is not possible.
index | an index of element to get. |
defaultValue | the default value |
See BooleanConverter.ToBooleanWithDefault(object, bool)
DateTime PipServices3.Commons.Data.AnyValueArray.GetAsDateTime | ( | int | index | ) |
Converts array element into a Date or returns current date if conversion is not possible.
index | an index of element to get. |
DateTime PipServices3.Commons.Data.AnyValueArray.GetAsDateTimeWithDefault | ( | int | index, |
DateTime? | defaultValue | ||
) |
Converts array element into a Date or returns default value if conversion is not possible.
index | an index of element to get. |
defaultValue | the default value |
See DateTimeConverter.ToDateTimeWithDefault(object, DateTime?)
double PipServices3.Commons.Data.AnyValueArray.GetAsDouble | ( | int | index | ) |
Converts array element into a double or returns 0 if conversion is not possible.
index | an index of element to get. |
double PipServices3.Commons.Data.AnyValueArray.GetAsDoubleWithDefault | ( | int | index, |
double | defaultValue | ||
) |
Converts array element into a double or returns default value if conversion is not possible.
index | an index of element to get. |
defaultValue | the default value |
See DoubleConverter.ToDoubleWithDefault(object, double)
float PipServices3.Commons.Data.AnyValueArray.GetAsFloat | ( | int | index | ) |
Converts array element into a float or returns 0 if conversion is not possible.
index | an index of element to get. |
float PipServices3.Commons.Data.AnyValueArray.GetAsFloatWithDefault | ( | int | index, |
float | defaultValue | ||
) |
Converts array element into a float or returns default value if conversion is not possible.
index | an index of element to get. |
defaultValue | the default value |
See FloatConverter.ToFloatWithDefault(object, float)
int PipServices3.Commons.Data.AnyValueArray.GetAsInteger | ( | int | index | ) |
Converts array element into an integer or returns 0 if conversion is not possible.
index | an index of element to get. |
int PipServices3.Commons.Data.AnyValueArray.GetAsIntegerWithDefault | ( | int | index, |
int | defaultValue | ||
) |
Converts array element into an integer or returns default value if conversion is not possible.
index | an index of element to get. |
defaultValue | the default value |
See IntegerConverter.ToIntegerWithDefault(object, int)
long PipServices3.Commons.Data.AnyValueArray.GetAsLong | ( | int | index | ) |
Converts array element into a long or returns 0 if conversion is not possible.
index | an index of element to get. |
long PipServices3.Commons.Data.AnyValueArray.GetAsLongWithDefault | ( | int | index, |
long | defaultValue | ||
) |
Converts array element into a long or returns default value if conversion is not possible.
index | an index of element to get. |
defaultValue | the default value |
See LongConverter.ToLongWithDefault(object, long)
AnyValueMap PipServices3.Commons.Data.AnyValueArray.GetAsMap | ( | int | index | ) |
Converts array element into an AnyValueMap or returns empty AnyValueMap if conversion is not possible.
index | an index of element to get. |
See AnyValueMap
AnyValueMap PipServices3.Commons.Data.AnyValueArray.GetAsMapWithDefault | ( | int | index, |
AnyValueMap | defaultValue | ||
) |
Converts array element into an AnyValueMap or returns default value if conversion is not possible.
index | an index of element to get. |
defaultValue | the default value |
AnyValueArray PipServices3.Commons.Data.AnyValueArray.GetAsNullableArray | ( | int | index | ) |
Converts array element into an AnyValueArray or returns null if conversion is not possible.
index | an index of element to get. |
bool PipServices3.Commons.Data.AnyValueArray.GetAsNullableBoolean | ( | int | index | ) |
Converts array element into a boolean or returns null if conversion is not possible.
index | an index of element to get. |
See BooleanConverter.ToNullableBoolean(object)
DateTime PipServices3.Commons.Data.AnyValueArray.GetAsNullableDateTime | ( | int | index | ) |
Converts array element into a Date or returns null if conversion is not possible.
index | an index of element to get. |
See DateTimeConverter.ToNullableDateTime(object)
double PipServices3.Commons.Data.AnyValueArray.GetAsNullableDouble | ( | int | index | ) |
Converts array element into a double or returns null if conversion is not possible.
index | an index of element to get. |
See DoubleConverter.ToNullableDouble(object)
float PipServices3.Commons.Data.AnyValueArray.GetAsNullableFloat | ( | int | index | ) |
Converts array element into a float or returns null if conversion is not possible.
index | an index of element to get. |
See FloatConverter.ToNullableFloat(object)
int PipServices3.Commons.Data.AnyValueArray.GetAsNullableInteger | ( | int | index | ) |
Converts array element into an integer or returns null if conversion is not possible.
index | an index of element to get. |
See IntegerConverter.ToNullableInteger(object)
long PipServices3.Commons.Data.AnyValueArray.GetAsNullableLong | ( | int | index | ) |
Converts array element into a long or returns null if conversion is not possible.
index | an index of element to get. |
See LongConverter.ToNullableLong(object)
AnyValueMap PipServices3.Commons.Data.AnyValueArray.GetAsNullableMap | ( | int | index | ) |
Converts array element into an AnyValueMap or returns null if conversion is not possible.
index | an index of element to get. |
See AnyValueMap
string PipServices3.Commons.Data.AnyValueArray.GetAsNullableString | ( | int | index | ) |
Converts array element into a string or returns null if conversion is not possible.
index | an index of element to get. |
See StringConverter.ToNullableString(object)
T PipServices3.Commons.Data.AnyValueArray.GetAsNullableType< T > | ( | int | index | ) |
Converts array element into a value defined by specied typecode. If conversion is not possible it returns null.
T | the class type |
index | an index of element to get. |
See TypeConverter.ToNullableType<T>(object)
T | : | struct |
T PipServices3.Commons.Data.AnyValueArray.GetAsNullableTypeWithDefault< T > | ( | int | index, |
T | defaultValue | ||
) |
Converts array element into a value defined by specied typecode. If conversion is not possible it returns default value.
T | the class type |
index | an index of element to get. |
defaultValue | the default value |
See TypeConverter.ToTypeWithDefault<T>(object, T)
object PipServices3.Commons.Data.AnyValueArray.GetAsObject | ( | ) |
Gets the value stored in this array element without any conversions
object PipServices3.Commons.Data.AnyValueArray.GetAsObject | ( | int | index | ) |
Gets an array element specified by its index.
index | an index of the element to get. |
string PipServices3.Commons.Data.AnyValueArray.GetAsString | ( | int | index | ) |
Converts array element into a string or returns "" if conversion is not possible.
index | an index of element to get. |
string PipServices3.Commons.Data.AnyValueArray.GetAsStringWithDefault | ( | int | index, |
string | defaultValue | ||
) |
Converts array element into a string or returns default value if conversion is not possible.
index | an index of element to get. |
defaultValue | the default value |
See StringConverter.ToStringWithDefault(object, string)
AnyValue PipServices3.Commons.Data.AnyValueArray.GetAsValue | ( | int | index | ) |
T PipServices3.Commons.Data.AnyValueArray.GetATypes< T > | ( | int | index | ) |
Converts array element into a value defined by specied typecode. If conversion is not possible it returns default value for the specified type..
T | the class type |
index | an index of element to get. |
See TypeConverter.ToType<T>(object)
|
virtual |
Sets a new value into array element specified by its index.
index | an index of the element to put. |
value | a new value for array element. |
void PipServices3.Commons.Data.AnyValueArray.SetAsObject | ( | object | value | ) |
Sets a new value for this array element
value | the new object value. |
void PipServices3.Commons.Data.AnyValueArray.SetAsObject | ( | int | index, |
object | value | ||
) |
Sets a new value into array element specified by its index.
index | an index of the element to put. |
value | a new value for array element. |
override string PipServices3.Commons.Data.AnyValueArray.ToString | ( | ) |
Gets a string representation of the object. The result is a comma-separated list of string representations of individual elements as "value1,value2,value3"
See StringConverter.ToString(object)