-
Notifications
You must be signed in to change notification settings - Fork 0
Utils.Extensions
Extension class helpers for JSON system.
public static class Extensions
Inheritance System.Object 🡒 Extensions
Always quote the string, and replace " with "
public static string AlwaysQuoteString(this string obj);
obj
System.String
string
System.String
quoted string
Append and escape control characters
public static System.Text.StringBuilder AppendEscapeControlCharsFull(this System.Text.StringBuilder str, string s);
Approximate equal
public static bool ApproxEquals(this double left, double right, double epsilon=2.2204460492503131E-16);
left
System.Double
right
System.Double
epsilon
System.Double
Change value to type
public static object ChangeTo(this System.Type type, object value);
type
System.Type
value
System.Object
Calculate a String parser CheckSumCharBlock value
public static uint Checksum(this string s);
Equals invariant.
Both A and B can be null, if both are null its true. If B is null only, its false as per Equals
public static bool EqualsI(this string a, string b);
a
System.String
this
b
System.String
string
Escape control characters
public static string EscapeControlCharsFull(this string obj);
obj
System.String
Get Type of field property
public static System.Type FieldPropertyType(this System.Reflection.MemberInfo mi);
mi
System.Reflection.MemberInfo
Parse integer from string invariant culture, return null if not parsed
public static System.Nullable<int> InvariantParseIntNull(this string s);
s
System.String
string
System.Nullable<System.Int32>
null of integer
Change wildcard to Reg Ex Wildcard
public static string RegExWildCardToRegular(this string value);
value
System.String
Set value in member
public static bool SetValue(this System.Reflection.MemberInfo mi, object instance, object value);
mi
System.Reflection.MemberInfo
instance
System.Object
value
System.Object
Convert character to hex value
public static System.Nullable<int> ToHex(this char c);
Number helper function - return 1 or 0
public static string ToStringIntValue(this bool v);
Number helper function
public static string ToStringInvariant(this double v);
Number helper function
public static string ToStringInvariant(this double v, string format);
format
System.String
Number helper function
public static string ToStringInvariant(this float v);
Number helper function
public static string ToStringInvariant(this float v, string format);
format
System.String
Number helper function
public static string ToStringInvariant(this int v);
Number helper function
public static string ToStringInvariant(this int v, string format);
format
System.String
Number helper function
public static string ToStringInvariant(this long v);
Number helper function
public static string ToStringInvariant(this long v, string format);
format
System.String
Number helper function
public static string ToStringInvariant(this System.Nullable<bool> v);
v
System.Nullable<System.Boolean>
Number helper function
public static string ToStringInvariant(this System.Nullable<double> v, string format);
v
System.Nullable<System.Double>
format
System.String
Number helper function
public static string ToStringInvariant(this System.Nullable<float> v, string format);
v
System.Nullable<System.Single>
format
System.String
Number helper function
public static string ToStringInvariant(this System.Nullable<int> v);
v
System.Nullable<System.Int32>
Number helper function
public static string ToStringInvariant(this System.Nullable<int> v, string format);
v
System.Nullable<System.Int32>
format
System.String
Number helper function
public static string ToStringInvariant(this System.Nullable<long> v);
v
System.Nullable<System.Int64>
Number helper function
public static string ToStringInvariant(this System.Nullable<long> v, string format);
v
System.Nullable<System.Int64>
format
System.String
Number helper function
public static string ToStringInvariant(this uint v);
Number helper function
public static string ToStringInvariant(this uint v, string format);
format
System.String
Number helper function
public static string ToStringInvariant(this ulong v);
Number helper function
public static string ToStringInvariant(this ulong v, string format);
format
System.String
Date helper function
public static string ToStringZulu(this System.DateTime dt);
Perform wild card Reg Ex
public static bool WildCardMatch(this string value, string match, bool caseinsensitive=false);
value
System.String
match
System.String
caseinsensitive
System.Boolean