ProtonNet Server 1.0
An Open Solution for all your socket or web api needs.
Loading...
Searching...
No Matches
XmobiTea.Data.GNHashtable Class Reference

Represents a generic hashtable data structure with various utility methods. More...

Inheritance diagram for XmobiTea.Data.GNHashtable:
XmobiTea.Data.GNData< string >

Classes

class  Builder
 A builder class for constructing instances of GNHashtable. More...
 

Public Member Functions

 GNHashtable ()
 Initializes a new instance of the GNHashtable class.
 
void Add (string key, object value)
 Adds a key-value pair to the hashtable.
 
ICollection< object > Values ()
 Gets the collection of values in the hashtable.
 
ICollection< string > Keys ()
 Gets the collection of keys in the hashtable.
 
bool ContainsKey (string key)
 Determines whether the hashtable contains a specific key.
 
void Clear ()
 Clears all elements from the hashtable.
 
bool Remove (string key)
 Removes the element with the specified key from the hashtable.
 
int Count ()
 Gets the number of elements contained in the hashtable.
 
IDictionary< string, T > ToDictionary< T > ()
 Converts the hashtable to a dictionary of the specified type.
 
override object GetObject (string k)
 Gets the object associated with the specified key.
 
override object ToData ()
 Converts the hashtable to a data object.
 
override string ToString ()
 Returns a string representation of the hashtable.
 
- Public Member Functions inherited from XmobiTea.Data.GNData< string >
object GetObject (TKey k)
 Abstract method to get an object based on the provided key.
 
object GetObject (TKey k, object defaultValue=null)
 Gets an object associated with the provided key.
 
sbyte GetSByte (TKey k, sbyte defaultValue=0)
 Gets a signed byte value associated with the provided key.
 
byte GetByte (TKey k, byte defaultValue=0)
 Gets a byte value associated with the provided key.
 
short GetShort (TKey k, short defaultValue=0)
 Gets a short value associated with the provided key.
 
ushort GetUShort (TKey k, ushort defaultValue=0)
 Gets an unsigned short value associated with the provided key.
 
int GetInt (TKey k, int defaultValue=0)
 Gets an int value associated with the provided key.
 
uint GetUInt (TKey k, uint defaultValue=0)
 Gets an unsigned int value associated with the provided key.
 
float GetFloat (TKey k, float defaultValue=0)
 Gets a float value associated with the provided key.
 
long GetLong (TKey k, long defaultValue=0)
 Gets a long value associated with the provided key.
 
ulong GetULong (TKey k, ulong defaultValue=0)
 Gets an unsigned long value associated with the provided key.
 
double GetDouble (TKey k, double defaultValue=0)
 Gets a double value associated with the provided key.
 
bool GetBool (TKey k, bool defaultValue=false)
 Gets a boolean value associated with the provided key.
 
string GetString (TKey k, string defaultValue=null)
 Gets a string value associated with the provided key.
 
T[] GetArray< T > (TKey k, T[] defaultValue=null)
 Gets an array of a specified type associated with the provided key.
 
System.Collections.Generic.IList< T > GetList< T > (TKey k, System.Collections.Generic.IList< T > defaultValue=null)
 Gets a list of a specified type associated with the provided key.
 
System.Collections.Generic.IDictionary< string, TObject > GetDictionary< TObject > (TKey k, System.Collections.Generic.IDictionary< string, TObject > defaultValue=null)
 Gets a dictionary of a specified type associated with the provided key.
 
GNArray GetGNArray (TKey k, GNArray defaultValue=null)
 Gets a GNArray object associated with the provided key.
 
GNHashtable GetGNHashtable (TKey k, GNHashtable defaultValue=null)
 Gets a GNHashtable object associated with the provided key.
 
object ToData ()
 Abstract method to convert the data to an object.
 

Static Public Member Functions

static Builder NewBuilder ()
 Creates a new instance of the Builder class for building a GNHashtable.
 

Additional Inherited Members

- Protected Member Functions inherited from XmobiTea.Data.GNData< string >
object CreateUseDataFromOriginData (object value)
 Creates data that can be used from the original data.
 
object CreateDataFromUseData (object value)
 Converts the use data back into its original form.
 
object CustomGet (TKey k)
 Custom method to retrieve an object based on the key and its type.
 

Detailed Description

Represents a generic hashtable data structure with various utility methods.

Member Function Documentation

◆ Add()

void XmobiTea.Data.GNHashtable.Add ( string key,
object value )

Adds a key-value pair to the hashtable.

Parameters
keyThe key of the element to add.
valueThe value of the element to add.

◆ ContainsKey()

bool XmobiTea.Data.GNHashtable.ContainsKey ( string key)

Determines whether the hashtable contains a specific key.

Parameters
keyThe key to locate in the hashtable.
Returns
True if the hashtable contains the specified key; otherwise, false.

◆ Count()

int XmobiTea.Data.GNHashtable.Count ( )

Gets the number of elements contained in the hashtable.

Returns
The count of elements in the hashtable.

◆ GetObject()

override object XmobiTea.Data.GNHashtable.GetObject ( string k)

Gets the object associated with the specified key.

Parameters
kThe key of the object to retrieve.
Returns
The object associated with the specified key, or null if the key is not found.

◆ Keys()

ICollection< string > XmobiTea.Data.GNHashtable.Keys ( )

Gets the collection of keys in the hashtable.

Returns
A collection of keys in the hashtable.

◆ NewBuilder()

static Builder XmobiTea.Data.GNHashtable.NewBuilder ( )
static

Creates a new instance of the Builder class for building a GNHashtable.

Returns
A new Builder instance.

◆ Remove()

bool XmobiTea.Data.GNHashtable.Remove ( string key)

Removes the element with the specified key from the hashtable.

Parameters
keyThe key of the element to remove.
Returns
True if the element is successfully removed; otherwise, false.

◆ ToData()

override object XmobiTea.Data.GNHashtable.ToData ( )

Converts the hashtable to a data object.

Returns
A dictionary containing the data representation of the hashtable.

◆ ToDictionary< T >()

IDictionary< string, T > XmobiTea.Data.GNHashtable.ToDictionary< T > ( )

Converts the hashtable to a dictionary of the specified type.

Template Parameters
TThe type of values in the resulting dictionary.
Returns
A dictionary with string keys and values of type T .

◆ ToString()

override string XmobiTea.Data.GNHashtable.ToString ( )

Returns a string representation of the hashtable.

Returns
A string representing the hashtable.

◆ Values()

ICollection< object > XmobiTea.Data.GNHashtable.Values ( )

Gets the collection of values in the hashtable.

Returns
A collection of objects in the hashtable.

The documentation for this class was generated from the following file: