Class Extensions
A class providing various extension methods.
Inheritance
Inherited Members
Namespace: IPA.Utilities
Assembly: IPA.Loader.dll
Syntax
public static class Extensions
Methods
| Improve this Doc View SourceGetDefault(Type)
Gets the default value for a given System.Type.
Declaration
public static object GetDefault(this Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | the System.Type to get the default value for |
Returns
Type | Description |
---|---|
System.Object | the default value of |
IsSubPathOf(String, String)
Returns true if path
starts with the path baseDirPath
.
The comparison is case-insensitive, handles / and \ slashes as folder separators and
only matches if the base dir folder name is matched exactly ("c:\foobar\file.txt" is not a sub path of "c:\foo").
Declaration
public static bool IsSubPathOf(this string path, string baseDirPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | |
System.String | baseDirPath |
Returns
Type | Description |
---|---|
System.Boolean |
Right(String, Int32)
Gets the rightmost length
characters from a string.
Declaration
public static string Right(this string value, int length)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The string to retrieve the substring from. |
System.Int32 | length | The number of characters to retrieve. |
Returns
Type | Description |
---|---|
System.String | The substring. |
Unwrap(Nullable<Boolean>)
Unwraps a System.Nullable<T> where T is System.Boolean such that if the value is null, it gives false.
Declaration
public static bool Unwrap(this bool? self)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Boolean> | self | the bool? to unwrap |
Returns
Type | Description |
---|---|
System.Boolean | the unwrapped value, or false if it was null |
WithEnding(String, String)
Returns str
with the minimal concatenation of ending
(starting from end) that
results in satisfying .EndsWith(ending).
Declaration
public static string WithEnding(this string str, string ending)
Parameters
Type | Name | Description |
---|---|---|
System.String | str | |
System.String | ending |
Returns
Type | Description |
---|---|
System.String |
Examples
"hel".WithEnding("llo") returns "hello", which is the result of "hel" + "lo".