TriLib
Search Results for

    Show / Hide Table of Contents

    Class IObjectExtensions

    Provides extension methods for disposing objects that may or may not implement IDisposable.

    Inheritance
    object
    IObjectExtensions
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: TriLibCore.Extensions
    Assembly: TriLibCore.dll
    Syntax
    public static class IObjectExtensions

    Methods

    TryToDispose<T>(IList<T>)

    Attempts to dispose the specified IList<T> if it implements IDisposable.

    Declaration
    public static void TryToDispose<T>(this IList<T> obj)
    Parameters
    Type Name Description
    IList<T> obj

    The IList<T> to attempt disposing.

    Type Parameters
    Name Description
    T

    The type parameter representing the items of the list.

    Remarks

    If obj does not implement IDisposable, this method will do nothing. No exception will be thrown if the cast to IDisposable fails.

    TryToDispose<T>(object)

    Attempts to dispose the specified obj if it implements IDisposable.

    Declaration
    public static void TryToDispose<T>(this object obj)
    Parameters
    Type Name Description
    object obj

    The object to attempt disposing.

    Type Parameters
    Name Description
    T

    The type parameter representing the object's value type.

    Remarks

    If obj does not implement IDisposable, this method will do nothing. No exception will be thrown if the cast to IDisposable fails.

    In this article
    Back to top Generated by DocFX