Class BaseExtensions
Extension methods.
Inheritance
System.Object
BaseExtensions
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: PiXYZ.Utils
Assembly: cs.temp.dll.dll
Syntax
public static class BaseExtensions
Methods
AddOrGet<K, V>(Dictionary<K, V>, K, V)
Add key and value pair to a dictionary if key wasn't present or get existing value for corresponding key otherwise.
Declaration
public static V AddOrGet<K, V>(this Dictionary<K, V> dictionary, K key, V defaultValue)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<K, V> | dictionary | |
K | key | Dictionary key to look for |
V | defaultValue | Value to set if key wasn't present in the dictionary |
Returns
Type | Description |
---|---|
V |
Type Parameters
Name | Description |
---|---|
K | |
V |
FancifyCamelCase(String)
Transforms a camelCase string into a fancy string.
Declaration
public static string FancifyCamelCase(this string str)
Parameters
Type | Name | Description |
---|---|---|
System.String | str |
Returns
Type | Description |
---|---|
System.String |
FormatNicely(TimeSpan)
Declaration
public static string FormatNicely(this TimeSpan time)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | time |
Returns
Type | Description |
---|---|
System.String |
LogColor(Color, Object)
Declaration
public static void LogColor(Color color, object message)
Parameters
Type | Name | Description |
---|---|---|
Color | color | |
System.Object | message |
MatchEnumWithCustomValue<E>(ref E, ref E, ref Int32, ref Int32)
This function allows the use of custom values for an enum. If the int value is not defined in the enum, the Enum at value 0 is picked (custom). If the enum value is changed, the current int value get changed.
Declaration
public static void MatchEnumWithCustomValue<E>(ref E prevEnum, ref E currEnum, ref int prefValue, ref int currValue)
Parameters
Type | Name | Description |
---|---|---|
E | prevEnum | |
E | currEnum | |
System.Int32 | prefValue | |
System.Int32 | currValue |
Type Parameters
Name | Description |
---|---|
E | Enum to use. Enum value equal to 0 must be the Custom one |
Swap<T>(ref T, ref T)
Swaps values or references between two items.
Declaration
public static void Swap<T>(ref T A, ref T B)
Parameters
Type | Name | Description |
---|---|---|
T | A | First item |
T | B | Second item |
Type Parameters
Name | Description |
---|---|
T | Items type |