Class Extensions
A class providing various extension methods.
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 Type.
Declaration
public static object GetDefault(this Type type)
Parameters
Type | Name | Description |
---|---|---|
Type | type | the Type to get the default value for |
Returns
Type | Description |
---|---|
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 |
---|---|---|
String | path | |
String | baseDirPath |
Returns
Type | Description |
---|---|
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 |
---|---|---|
String | value | The string to retrieve the substring from. |
Int32 | length | The number of characters to retrieve. |
Returns
Type | Description |
---|---|
String | The substring. |
Unwrap(Nullable<Boolean>)
Unwraps a Nullable<T> where T is Boolean such that if the value is null, it gives false.
Declaration
public static bool Unwrap(this bool? self)
Parameters
Type | Name | Description |
---|---|---|
Nullable<Boolean> | self | the bool? to unwrap |
Returns
Type | Description |
---|---|
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 |
---|---|---|
String | str | |
String | ending |
Returns
Type | Description |
---|---|
String |
Examples
"hel".WithEnding("llo") returns "hello", which is the result of "hel" + "lo".