Search Results for

    Show / Hide Table of Contents

    Class Extensions

    A class providing various extension methods.

    Inheritance
    System.Object
    Extensions
    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: IPA.Utilities
    Assembly: IPA.Loader.dll
    Syntax
    public static class Extensions

    Methods

    | Improve this Doc View Source

    GetDefault(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 type

    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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.

    | Improve this Doc View Source

    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

    | Improve this Doc View Source

    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".

    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX