CotC C# SDK for Unity  v1.4.0.1
Making social games is easy !
Public Types | Properties | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members

Description

The bundle is a main concept of the CotC SDK. It is basically the equivalent of a JSON object, behaving like a C# dictionary, but with inferred typing and more safety.

You need bundles in many calls, either to decode generic data received by the server (when such data can be enriched by hooks typically) or to pass generic user parameters, such as when creating a match.

Bundles are instantiated through their factory methods: Bundle.CreateObject or Bundle.CreateArray. The type of the resulting object can be inspected via the Type member. While objects and arrays are containers for further objects, a bundle is a simple node in the graph and may as such contain a value, such as a string.

Sub-objects are fetched using the index operator (brackets), either with a numeric argument for arrays or a string argument for dictionaries. Conversions are performed automatically based. Let's consider the following example:

Bundle b = Bundle.CreateObject();
b["hello"] = "world";

The bundle object, considered as dictionary will have its key "hello" set with a new Bundle node of type string (implicitly created from the string). So later on, you might fetch this value as well:

string value = b["hello"];

What happens here is that the bundle under the key "hello" is fetched, and then implicitly converted to a string.

Bundle provides a safe way to browse a predefined graph, as when a key doesn't exist it returns the Bundle.Empty (no null value). This special bundle allows to fetch sub-objects but they will always translate to Bundle.Empty as well. If the values are to be converted to a primitive type, the result will be the default value for this type (null for a string, 0 for an int, etc.). As such, you may do this:

int value = bundle["nonexisting"]["key"];

Since the "nonexisting" key is not found on bundle, Bundle.Empty is returned. Further fetching "key" will return an empty bundle as well. Which will be converted implicitly to an integer as 0. Bundle.Empty is a constant value that always refers to an empty bundle, and attempting to modify it will result in an exception.

Bundle b = Bundle.Empty;
b["value"] = "something"; // Exception

The bundle hierarchy doesn't accept null or Bundle.Empty values (it just rejects them). You should avoid manipulating null Bundles and use Bundle.Empty wherever possible, however you may assign a null bundle to a key, which will have no effect. This can be useful for optional arguments. For instance, the following snippet will not affect the bundle.

string value = null; // converts to Bundle.Empty and rejects assignment
bundle["key"] = value;

Note that Bundle.Empty is not strictly identical to an empty bundle object. Bundle.Empty is never considered as a value and is discarded upon assignment. For instance:

Bundle a = Bundle.CreateObject();
Bundle b = Bundle.CreateObject();
a["key"] = Bundle.Empty;
b["key"] = Bundle.CreateObject();
Log(a.ToJson()); // {}
Log(b.ToJson()); // {"key": {}}

If you need a special value for keys that do not match the expected type or are not found in the hierarchy, you may as well use the .As* methods. For instance, the previous snippet could be written as follows to have a default value of one:

int value = bundle["nonexisting"]["key"].AsInt(1);

It is also possible to inspect the Type property of the Bundle in order to ensure that the value was provided as expected.

A bundle may be pre-filled at creation by passing arguments to Bundle.CreateObject and Bundle.CreateArray. For instance:

Bundle b = Bundle.CreateObject("key1", "value1", "key2", "value2");

Is equivalent to writing:

Bundle b = Bundle.CreateObject();
b["key1"] = "value1";
b["key2"] = "value2";

A bundle can quickly be transformed from/to JSON using ToJson and Bundle.FromJson methods. One can also check for the presence of keys and remove them with the .Has respectively .Remove methods.

Iterating a JSON object is made using the explicit .As* methods. For instance, here is how you iterate over an array bundle (no harm will happen if the key doesn't exist or is not an array, since an empty array is returned):

foreach (Bundle value in b) { ... }

For an object, use AsDictionary().

foreach (KeyValuePair<string, Bundle> pair in b["key"].AsDictionary()) { ... }

This loop is safe as well even if the bundle doesn't contain a "key" entry or the "key" entry is not an object.

Null bundles should be avoided! Use Bundle.Empty every time you need a "void", non mutable bundle value. Converting from a null bundle will result in an exception.

Bundle b = null;
string value = b; // Null pointer exception!

That's all what there is to know about bundles. In general they should make any code interacting with generic objects simple and safe.

Public Types

enum  DataType {
  None, Boolean, Integer, Double,
  String, Array, Object
}
 Possible types of data storable into a bundle. More...
 

Properties

virtual Bundlethis[string key] [get, set]
 Gets object type (Dictionary) Bundle's key value. More...
 
virtual Bundle this[int index] [get, set]
 Gets array type (List) Bundle's index value. More...
 
bool IsEmpty [get]
 Tests if a Bundle (any type) has any value set. More...
 
Bundle Root [get]
 Returns the root of this tree. Goes as far as possible back in the hierarchy. More...
 
DataType Type [get]
 Gets Bundle's value data type. Should be DataType.None until any value is set to this Bundle. More...
 
Bundle Parent [get]
 Returns the parent of this bundle, if it was detached from any tree. May be null if it is the root or has never been attached. More...
 

Public Member Functions

 Bundle (bool value)
 Creates a new Bundle of Boolean type from a bool value. More...
 
 Bundle (int value)
 Creates a new Bundle of Integer type from an int value. More...
 
 Bundle (long value)
 Creates a new Bundle of Integer type from a long value. More...
 
 Bundle (float value)
 Creates a new Bundle of Double type from a float value. More...
 
 Bundle (double value)
 Creates a new Bundle of Double type from a double value. More...
 
 Bundle (string value)
 Creates a new Bundle of String type from a string value. More...
 
override int GetHashCode ()
 Call the standard Object.GetHashCode() method to compute a hash code for this Bundle. More...
 
bool Equals (Bundle b)
 Compares the Bundle with another one to find out if they are equal. Compares instances references first, then tries to compare Bundles' values. Warning: The converted values are actually compared, then a "1" integer or string type Bundle would match a "true" bool type Bundle for example. More...
 
override bool Equals (object obj)
 Compares the Bundle with any object (expected to be another Bundle) to find out if they are equal. Compares instances references first, then tries to compare Bundles' values. Warning: The converted values are actually compared, then a "1" integer or string type Bundle would match a "true" bool type Bundle for example. More...
 
bool Has (string key)
 Tests if an object type (Dictionary) Bundle has a given key defined. More...
 
void Remove (string key)
 Removes an object type (Dictionary) Bundle's key value. More...
 
void Add (Bundle value)
 Adds a Bundle value to this array-type (List) Bundle. More...
 
Bundle Clone ()
 Deep copies the bundle. More...
 
bool GetBool (string key, bool defaultValue=false)
 Gets an object type (Dictionary) Bundle's key bool value. More...
 
int GetInt (string key, int defaultValue=0)
 Gets an object type (Dictionary) Bundle's key int value. More...
 
long GetLong (string key, long defaultValue=0L)
 Gets an object type (Dictionary) Bundle's key long value. More...
 
float GetFloat (string key, float defaultValue=0f)
 Gets an object type (Dictionary) Bundle's key float value. More...
 
double GetDouble (string key, double defaultValue=0d)
 Gets an object type (Dictionary) Bundle's key double value. More...
 
string GetString (string key, string defaultValue=null)
 Gets an object type (Dictionary) Bundle's key string value. More...
 
bool GetBool (int index, bool defaultValue=false)
 Gets an array type (List) Bundle's index bool value. More...
 
int GetInt (int index, int defaultValue=0)
 Gets an array type (List) Bundle's index int value. More...
 
long GetLong (int index, long defaultValue=0L)
 Gets an array type (List) Bundle's index long value. More...
 
float GetFloat (int index, float defaultValue=0f)
 Gets an array type (List) Bundle's index float value. More...
 
double GetDouble (int index, double defaultValue=0d)
 Gets an array type (List) Bundle's index double value. More...
 
string GetString (int index, string defaultValue=null)
 Gets an array type (List) Bundle's index string value. More...
 
bool AsBool (bool defaultValue=false)
 Gets a Bundle's value as a bool converted value. More...
 
int AsInt (int defaultValue=0)
 Gets a Bundle's value as a int converted value. More...
 
long AsLong (long defaultValue=0L)
 Gets a Bundle's value as a long converted value. More...
 
float AsFloat (float defaultValue=0f)
 Gets a Bundle's value as a float converted value. More...
 
double AsDouble (double defaultValue=0d)
 Gets a Bundle's value as a double converted value. More...
 
string AsString (string defaultValue=null)
 Gets a Bundle's value as a string converted value. More...
 
Dictionary< string, BundleAsDictionary ()
 Gets object type Bundle as a Dictionary. More...
 
List< BundleAsArray ()
 Gets array type Bundle as a List. More...
 
string ToJson ()
 Gets all bundle's data as a json-like string. More...
 
override string ToString ()
 Gets all bundle's data as a human readable string. (actually calls ToJson()) More...
 

Static Public Member Functions

static Bundle CreateObject ()
 Creates a bundle of type object. More...
 
static Bundle CreateObject (string key, Bundle value)
 Creates a bundle of type object with one key/value pair which will be put in the object initially. More...
 
static Bundle CreateObject (string key1, Bundle value1, string key2, Bundle value2)
 Creates a bundle of type object with two key/value pairs which will be put in the object initially. More...
 
static Bundle CreateObject (string key1, Bundle value1, string key2, Bundle value2, string key3, Bundle value3)
 Creates a bundle of type object with three key/value pairs which will be put in the object initially. More...
 
static Bundle CreateObject (params KeyValuePair< string, Bundle >[] keyValuePairs)
 Creates a bundle of type object with many key/value pairs which will be put in the object initially. More...
 
static Bundle CreateArray (params Bundle[] values)
 Creates a bundle of type array. More...
 
static implicit operator Bundle (bool value)
 Implicitly creates a new Bundle of Boolean type from a bool value. More...
 
static implicit operator Bundle (int value)
 Implicitly creates a new Bundle of Integer type from an int value. More...
 
static implicit operator Bundle (long value)
 Implicitly creates a new Bundle of Integer type from a long value. More...
 
static implicit operator Bundle (float value)
 Implicitly creates a new Bundle of Double type from a float value. More...
 
static implicit operator Bundle (double value)
 Implicitly creates a new Bundle of Double type from a double value. More...
 
static implicit operator Bundle (string value)
 Implicitly creates a new Bundle of String type from a string value. More...
 
static implicit operator bool (Bundle b)
 Implicitly gets a Bundle's value as a bool converted value. More...
 
static implicit operator int (Bundle b)
 Implicitly gets a Bundle's value as an int converted value. More...
 
static implicit operator long (Bundle b)
 Implicitly gets a Bundle's value as a long converted value. More...
 
static implicit operator float (Bundle b)
 Implicitly gets a Bundle's value as a float converted value. More...
 
static implicit operator double (Bundle b)
 Implicitly gets a Bundle's value as a double converted value. More...
 
static implicit operator string (Bundle b)
 Implicitly gets a Bundle's value as a string converted value. More...
 
static bool operator== (Bundle b, object obj)
 Compares the Bundle with any object (expected to be another Bundle) to find out if they are equal. Compares instances references first, then tries to compare Bundles' values. Warning: The converted values are actually compared, then a "1" integer or string type Bundle would match a "true" bool type Bundle for example. More...
 
static bool operator != (Bundle b, object obj)
 Compares the Bundle with any object (expected to be another Bundle) to find out if they are different. Compares instances references first, then tries to compare Bundles' values. Warning: The converted values are actually compared, then a "1" integer or string type Bundle would match a "true" bool type Bundle for example. More...
 
static Bundle FromAnyJson (string json)
 Builds a complete Bundle hierarchy representing data from a json-like string. Works even if the root json token is a simple value type like a string or a number. More...
 
static Bundle FromJson (string json)
 Builds a complete Bundle hierarchy representing data from a json-like string. Works only if the root json token is an object or an array, but not a simple value type like a string or a number (in this case use FromAnyJson() instead). More...
 

Static Public Attributes

static readonly EmptyBundle Empty = new EmptyBundle()
 Empty (null-like) Bundle. See class documentation for more information. More...
 

Protected Member Functions

 Bundle (DataType dataType)
 Builds a fresh new Bundle from a data type. More...
 
Inheritance diagram for CotcSdk.Bundle:
CotcSdk.EmptyBundle

Member Enumeration Documentation

◆ DataType

Possible types of data storable into a bundle.

Constructor & Destructor Documentation

◆ Bundle() [1/7]

CotcSdk.Bundle.Bundle ( DataType  dataType)
protected

Builds a fresh new Bundle from a data type.

Returns
A new Bundle instance.

◆ Bundle() [2/7]

CotcSdk.Bundle.Bundle ( bool  value)

Creates a new Bundle of Boolean type from a bool value.

Returns
A new Boolean Bundle from a bool value.

◆ Bundle() [3/7]

CotcSdk.Bundle.Bundle ( int  value)

Creates a new Bundle of Integer type from an int value.

Returns
A new Integer Bundle from an int value.

◆ Bundle() [4/7]

CotcSdk.Bundle.Bundle ( long  value)

Creates a new Bundle of Integer type from a long value.

Returns
A new Integer Bundle from a long value.

◆ Bundle() [5/7]

CotcSdk.Bundle.Bundle ( float  value)

Creates a new Bundle of Double type from a float value.

Returns
A new Double Bundle from a float value.

◆ Bundle() [6/7]

CotcSdk.Bundle.Bundle ( double  value)

Creates a new Bundle of Double type from a double value.

Returns
A new Double Bundle from a double value.

◆ Bundle() [7/7]

CotcSdk.Bundle.Bundle ( string  value)

Creates a new Bundle of String type from a string value.

Returns
A new String Bundle from a string value.

Property Documentation

◆ IsEmpty

bool CotcSdk.Bundle.IsEmpty
get

Tests if a Bundle (any type) has any value set.

Returns
If Bundle has any value set.

◆ Parent

Bundle CotcSdk.Bundle.Parent
get

Returns the parent of this bundle, if it was detached from any tree. May be null if it is the root or has never been attached.

◆ Root

Bundle CotcSdk.Bundle.Root
get

Returns the root of this tree. Goes as far as possible back in the hierarchy.

◆ this[int index]

virtual Bundle CotcSdk.Bundle.this[int index]
getset

Gets array type (List) Bundle's index value.

Parameters
indexIndex of the value to return.
Returns
A Bundle being the value of the given index.

◆ this[string key]

virtual Bundle? CotcSdk.Bundle.this[string key]
getset

Gets object type (Dictionary) Bundle's key value.

Parameters
keyKey of the value to return.
Returns
A Bundle being the value of the given key.

◆ Type

DataType CotcSdk.Bundle.Type
get

Gets Bundle's value data type. Should be DataType.None until any value is set to this Bundle.

Returns
Bundle's value data type.

Member Function Documentation

◆ Add()

void CotcSdk.Bundle.Add ( Bundle  value)

Adds a Bundle value to this array-type (List) Bundle.

Parameters
valueThe Bundle value to add.

◆ AsArray()

List<Bundle> CotcSdk.Bundle.AsArray ( )

Gets array type Bundle as a List.

Returns
Bundle's data as a List.

◆ AsBool()

bool CotcSdk.Bundle.AsBool ( bool  defaultValue = false)

Gets a Bundle's value as a bool converted value.

Parameters
defaultValueThe default bool value to return if Bundle's value couldn't be converted.
Returns
Bundle's value converted as a bool value.

◆ AsDictionary()

Dictionary<string, Bundle> CotcSdk.Bundle.AsDictionary ( )

Gets object type Bundle as a Dictionary.

Returns
Bundle's data as a Dictionary.

◆ AsDouble()

double CotcSdk.Bundle.AsDouble ( double  defaultValue = 0d)

Gets a Bundle's value as a double converted value.

Parameters
defaultValueThe default double value to return if Bundle's value couldn't be converted.
Returns
Bundle's value converted as a double value.

◆ AsFloat()

float CotcSdk.Bundle.AsFloat ( float  defaultValue = 0f)

Gets a Bundle's value as a float converted value.

Parameters
defaultValueThe default float value to return if Bundle's value couldn't be converted.
Returns
Bundle's value converted as a float value.

◆ AsInt()

int CotcSdk.Bundle.AsInt ( int  defaultValue = 0)

Gets a Bundle's value as a int converted value.

Parameters
defaultValueThe default int value to return if Bundle's value couldn't be converted.
Returns
Bundle's value converted as a int value.

◆ AsLong()

long CotcSdk.Bundle.AsLong ( long  defaultValue = 0L)

Gets a Bundle's value as a long converted value.

Parameters
defaultValueThe default long value to return if Bundle's value couldn't be converted.
Returns
Bundle's value converted as a long value.

◆ AsString()

string CotcSdk.Bundle.AsString ( string  defaultValue = null)

Gets a Bundle's value as a string converted value.

Parameters
defaultValueThe default string value to return if Bundle's value couldn't be converted.
Returns
Bundle's value converted as a string value.

◆ Clone()

Bundle CotcSdk.Bundle.Clone ( )

Deep copies the bundle.

◆ CreateArray()

static Bundle CotcSdk.Bundle.CreateArray ( params Bundle []  values)
static

Creates a bundle of type array.

Parameters
valuesOptional values to pre-fill the array with. Since bundle are implicitly converted, remember that you may pass an integer, string, etc.
Returns
A new bundle.

◆ CreateObject() [1/5]

static Bundle CotcSdk.Bundle.CreateObject ( )
static

Creates a bundle of type object.

Returns
A new bundle.

◆ CreateObject() [2/5]

static Bundle CotcSdk.Bundle.CreateObject ( string  key,
Bundle  value 
)
static

Creates a bundle of type object with one key/value pair which will be put in the object initially.

Returns
A new bundle filled with one key/value pair.

◆ CreateObject() [3/5]

static Bundle CotcSdk.Bundle.CreateObject ( string  key1,
Bundle  value1,
string  key2,
Bundle  value2 
)
static

Creates a bundle of type object with two key/value pairs which will be put in the object initially.

Returns
A new bundle filled with two key/value pairs.

◆ CreateObject() [4/5]

static Bundle CotcSdk.Bundle.CreateObject ( string  key1,
Bundle  value1,
string  key2,
Bundle  value2,
string  key3,
Bundle  value3 
)
static

Creates a bundle of type object with three key/value pairs which will be put in the object initially.

Returns
A new bundle filled with three key/value pairs.

◆ CreateObject() [5/5]

static Bundle CotcSdk.Bundle.CreateObject ( params KeyValuePair< string, Bundle > []  keyValuePairs)
static

Creates a bundle of type object with many key/value pairs which will be put in the object initially.

Returns
A new bundle filled with many key/value pairs.

◆ Equals() [1/2]

bool CotcSdk.Bundle.Equals ( Bundle  b)

Compares the Bundle with another one to find out if they are equal. Compares instances references first, then tries to compare Bundles' values. Warning: The converted values are actually compared, then a "1" integer or string type Bundle would match a "true" bool type Bundle for example.

Parameters
bThe Bundle from which to compare the value with the current Bundle's one.
Returns
If the bundles' references or their converted values are equal.

◆ Equals() [2/2]

override bool CotcSdk.Bundle.Equals ( object  obj)

Compares the Bundle with any object (expected to be another Bundle) to find out if they are equal. Compares instances references first, then tries to compare Bundles' values. Warning: The converted values are actually compared, then a "1" integer or string type Bundle would match a "true" bool type Bundle for example.

Parameters
objThe object from which to compare the value with the current Bundle's one.
Returns
If the object's and bundle's references or their converted values are equal.

◆ FromAnyJson()

static Bundle CotcSdk.Bundle.FromAnyJson ( string  json)
static

Builds a complete Bundle hierarchy representing data from a json-like string. Works even if the root json token is a simple value type like a string or a number.

Parameters
jsonThe json-like string to parse.
Returns
Bundle's data from a json-like string.

◆ FromJson()

static Bundle CotcSdk.Bundle.FromJson ( string  json)
static

Builds a complete Bundle hierarchy representing data from a json-like string. Works only if the root json token is an object or an array, but not a simple value type like a string or a number (in this case use FromAnyJson() instead).

Parameters
jsonThe json-like string to parse.
Returns
Bundle's data from a json-like string.

◆ GetBool() [1/2]

bool CotcSdk.Bundle.GetBool ( string  key,
bool  defaultValue = false 
)

Gets an object type (Dictionary) Bundle's key bool value.

Parameters
keyKey of the bool value to return.
defaultValueThe default bool value to return if the given key doesn't exist.
Returns
A bool being the value of the given key.

◆ GetBool() [2/2]

bool CotcSdk.Bundle.GetBool ( int  index,
bool  defaultValue = false 
)

Gets an array type (List) Bundle's index bool value.

Parameters
indexIndex of the bool value to return.
defaultValueThe default bool value to return if the given index doesn't exist.
Returns
A bool being the value of the given index.

◆ GetDouble() [1/2]

double CotcSdk.Bundle.GetDouble ( string  key,
double  defaultValue = 0d 
)

Gets an object type (Dictionary) Bundle's key double value.

Parameters
keyKey of the double value to return.
defaultValueThe default double value to return if the given key doesn't exist.
Returns
A double being the value of the given key.

◆ GetDouble() [2/2]

double CotcSdk.Bundle.GetDouble ( int  index,
double  defaultValue = 0d 
)

Gets an array type (List) Bundle's index double value.

Parameters
indexIndex of the double value to return.
defaultValueThe default double value to return if the given index doesn't exist.
Returns
A double being the value of the given index.

◆ GetFloat() [1/2]

float CotcSdk.Bundle.GetFloat ( string  key,
float  defaultValue = 0f 
)

Gets an object type (Dictionary) Bundle's key float value.

Parameters
keyKey of the float value to return.
defaultValueThe default float value to return if the given key doesn't exist.
Returns
A float being the value of the given key.

◆ GetFloat() [2/2]

float CotcSdk.Bundle.GetFloat ( int  index,
float  defaultValue = 0f 
)

Gets an array type (List) Bundle's index float value.

Parameters
indexIndex of the float value to return.
defaultValueThe default float value to return if the given index doesn't exist.
Returns
A float being the value of the given index.

◆ GetHashCode()

override int CotcSdk.Bundle.GetHashCode ( )

Call the standard Object.GetHashCode() method to compute a hash code for this Bundle.

Returns
Bundle's hash code.

◆ GetInt() [1/2]

int CotcSdk.Bundle.GetInt ( string  key,
int  defaultValue = 0 
)

Gets an object type (Dictionary) Bundle's key int value.

Parameters
keyKey of the int value to return.
defaultValueThe default int value to return if the given key doesn't exist.
Returns
A int being the value of the given key.

◆ GetInt() [2/2]

int CotcSdk.Bundle.GetInt ( int  index,
int  defaultValue = 0 
)

Gets an array type (List) Bundle's index int value.

Parameters
indexIndex of the int value to return.
defaultValueThe default int value to return if the given index doesn't exist.
Returns
A int being the value of the given index.

◆ GetLong() [1/2]

long CotcSdk.Bundle.GetLong ( string  key,
long  defaultValue = 0L 
)

Gets an object type (Dictionary) Bundle's key long value.

Parameters
keyKey of the long value to return.
defaultValueThe default long value to return if the given key doesn't exist.
Returns
A long being the value of the given key.

◆ GetLong() [2/2]

long CotcSdk.Bundle.GetLong ( int  index,
long  defaultValue = 0L 
)

Gets an array type (List) Bundle's index long value.

Parameters
indexIndex of the long value to return.
defaultValueThe default long value to return if the given index doesn't exist.
Returns
A long being the value of the given index.

◆ GetString() [1/2]

string CotcSdk.Bundle.GetString ( string  key,
string  defaultValue = null 
)

Gets an object type (Dictionary) Bundle's key string value.

Parameters
keyKey of the string value to return.
defaultValueThe default string value to return if the given key doesn't exist.
Returns
A string being the value of the given key.

◆ GetString() [2/2]

string CotcSdk.Bundle.GetString ( int  index,
string  defaultValue = null 
)

Gets an array type (List) Bundle's index string value.

Parameters
indexIndex of the string value to return.
defaultValueThe default string value to return if the given index doesn't exist.
Returns
A string being the value of the given index.

◆ Has()

bool CotcSdk.Bundle.Has ( string  key)

Tests if an object type (Dictionary) Bundle has a given key defined.

Parameters
keyThe key to be searched for.
Returns
If the key does exist.

◆ operator !=()

static bool CotcSdk.Bundle.operator != ( Bundle  b,
object  obj 
)
static

Compares the Bundle with any object (expected to be another Bundle) to find out if they are different. Compares instances references first, then tries to compare Bundles' values. Warning: The converted values are actually compared, then a "1" integer or string type Bundle would match a "true" bool type Bundle for example.

Parameters
bThe Bundle to compare the value with the object's one.
objThe object from which to compare the value with the Bundle's one.
Returns
If the object's and bundle's references or their converted values are equal.

◆ operator bool()

static implicit CotcSdk.Bundle.operator bool ( Bundle  b)
static

Implicitly gets a Bundle's value as a bool converted value.

Returns
Bundle's value converted as a bool value.

◆ operator Bundle() [1/6]

static implicit CotcSdk.Bundle.operator Bundle ( bool  value)
static

Implicitly creates a new Bundle of Boolean type from a bool value.

Returns
A new Boolean Bundle from a bool value.

◆ operator Bundle() [2/6]

static implicit CotcSdk.Bundle.operator Bundle ( int  value)
static

Implicitly creates a new Bundle of Integer type from an int value.

Returns
A new Integer Bundle from an int value.

◆ operator Bundle() [3/6]

static implicit CotcSdk.Bundle.operator Bundle ( long  value)
static

Implicitly creates a new Bundle of Integer type from a long value.

Returns
A new Integer Bundle from a long value.

◆ operator Bundle() [4/6]

static implicit CotcSdk.Bundle.operator Bundle ( float  value)
static

Implicitly creates a new Bundle of Double type from a float value.

Returns
A new Double Bundle from a float value.

◆ operator Bundle() [5/6]

static implicit CotcSdk.Bundle.operator Bundle ( double  value)
static

Implicitly creates a new Bundle of Double type from a double value.

Returns
A new Double Bundle from a double value.

◆ operator Bundle() [6/6]

static implicit CotcSdk.Bundle.operator Bundle ( string  value)
static

Implicitly creates a new Bundle of String type from a string value.

Returns
A new String Bundle from a string value.

◆ operator double()

static implicit CotcSdk.Bundle.operator double ( Bundle  b)
static

Implicitly gets a Bundle's value as a double converted value.

Returns
Bundle's value converted as a double value.

◆ operator float()

static implicit CotcSdk.Bundle.operator float ( Bundle  b)
static

Implicitly gets a Bundle's value as a float converted value.

Returns
Bundle's value converted as a float value.

◆ operator int()

static implicit CotcSdk.Bundle.operator int ( Bundle  b)
static

Implicitly gets a Bundle's value as an int converted value.

Returns
Bundle's value converted as an int value.

◆ operator long()

static implicit CotcSdk.Bundle.operator long ( Bundle  b)
static

Implicitly gets a Bundle's value as a long converted value.

Returns
Bundle's value converted as a long value.

◆ operator string()

static implicit CotcSdk.Bundle.operator string ( Bundle  b)
static

Implicitly gets a Bundle's value as a string converted value.

Returns
Bundle's value converted as a string value.

◆ operator==()

static bool CotcSdk.Bundle.operator== ( Bundle  b,
object  obj 
)
static

Compares the Bundle with any object (expected to be another Bundle) to find out if they are equal. Compares instances references first, then tries to compare Bundles' values. Warning: The converted values are actually compared, then a "1" integer or string type Bundle would match a "true" bool type Bundle for example.

Parameters
bThe Bundle to compare the value with the object's one.
objThe object from which to compare the value with the Bundle's one.
Returns
If the object's and bundle's references or their converted values are equal.

◆ Remove()

void CotcSdk.Bundle.Remove ( string  key)

Removes an object type (Dictionary) Bundle's key value.

Parameters
keyThe key to delete the value.

◆ ToJson()

string CotcSdk.Bundle.ToJson ( )

Gets all bundle's data as a json-like string.

Returns
Bundle's data as a json-like string.

◆ ToString()

override string CotcSdk.Bundle.ToString ( )

Gets all bundle's data as a human readable string. (actually calls ToJson())

Returns
Bundle's data as a human readable string.

Member Data Documentation

◆ Empty

readonly EmptyBundle CotcSdk.Bundle.Empty = new EmptyBundle()
static

Empty (null-like) Bundle. See class documentation for more information.