Show / Hide Table of Contents
Improve this Doc View Source

Class Try<T>

Represents the success or failure of an operation.
Inheritance
System.Object
Try<T>
Namespace:NiceTry
Assembly:NiceTry.dll
Syntax
[DebuggerDisplay("{ToString(),nq}")]
public abstract class Try<T> : IComparable<Try<T>>, IEquatable<Try<T>>, IComparable, IStructuralComparable, IStructuralEquatable
Type Parameters
Name Description
T

Constructors

| Improve this Doc View Source

Try(TryKind)

Declaration
protected Try(TryKind kind)
Parameters
Type Name Description
TryKind kind

Properties

| Improve this Doc View Source

IsFailure

Indicates if this represents failure.
Declaration
public bool IsFailure
{

    get;

}
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsSuccess

Indicates if this represents success.
Declaration
public bool IsSuccess
{

    get;

}
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

Kind

Returns the kind of this instance.
Declaration
public TryKind Kind
{

    get;

}
Property Value
Type Description
TryKind

Methods

| Improve this Doc View Source

CompareTo(Try<T>)

Declaration
public int CompareTo(Try<T> other)
Parameters
Type Name Description
Try<T> other
Returns
Type Description
System.Int32
| Improve this Doc View Source

Equals(Try<T>)

Declaration
public bool Equals(Try<T> other)
Parameters
Type Name Description
Try<T> other
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean
| Improve this Doc View Source

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32
| Improve this Doc View Source

IfFailure(Action<Exception>)

Executes the specified <em>sideEffect</em> only if this instance
represents failure.
Declaration
public abstract void IfFailure([NotNull] Action<Exception> sideEffect)
Parameters
Type Name Description
System.Action<System.Exception> sideEffect
Exceptions
Type Condition
System.ArgumentNullException
<em>sideEffect</em> is <xref uid="langword_csharp_null" name="null" href=""></xref>.
| Improve this Doc View Source

IfSuccess(Action<T>)

Executes the specified <em>sideEffect</em> only if this instance
represents success.
Declaration
public abstract void IfSuccess([NotNull] Action<T> sideEffect)
Parameters
Type Name Description
System.Action<T> sideEffect
Exceptions
Type Condition
System.ArgumentNullException
<em>sideEffect</em> is <xref uid="langword_csharp_null" name="null" href=""></xref>.
| Improve this Doc View Source

Match(Action<T>, Action<Exception>)

Executes on of the specified side effects, depending on wether this instance
represents success or failure.
Declaration
public abstract void Match([NotNull] Action<T> success, [NotNull] Action<Exception> failure)
Parameters
Type Name Description
System.Action<T> success
System.Action<System.Exception> failure
Exceptions
Type Condition
System.ArgumentNullException
<em>success</em> or <em>failure</em> is <xref uid="langword_csharp_null" name="null" href=""></xref>.
| Improve this Doc View Source

Match<B>(Func<T, B>, Func<Exception, B>)

Executes on of the specified side effects, depending on wether this instance
represents success or failure, and returns the produced result.
Declaration
public abstract B Match<B>([NotNull] Func<T, B> success, [NotNull] Func<Exception, B> failure)
Parameters
Type Name Description
System.Func<T, B> success
System.Func<System.Exception, B> failure
Returns
Type Description
B
Type Parameters
Name Description
B
Exceptions
Type Condition
System.ArgumentNullException
<em>success</em> or <em>failure</em> is <xref uid="langword_csharp_null" name="null" href=""></xref>.
| Improve this Doc View Source

IStructuralComparable.CompareTo(Object, IComparer)

Declaration
int IStructuralComparable.CompareTo(object other, IComparer comparer)
Parameters
Type Name Description
System.Object other
System.Collections.IComparer comparer
Returns
Type Description
System.Int32
| Improve this Doc View Source

IStructuralEquatable.Equals(Object, IEqualityComparer)

Declaration
bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
Parameters
Type Name Description
System.Object other
System.Collections.IEqualityComparer comparer
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IStructuralEquatable.GetHashCode(IEqualityComparer)

Declaration
int IStructuralEquatable.GetHashCode(IEqualityComparer comparer)
Parameters
Type Name Description
System.Collections.IEqualityComparer comparer
Returns
Type Description
System.Int32
| Improve this Doc View Source

IComparable.CompareTo(Object)

Declaration
int IComparable.CompareTo(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Int32
| Improve this Doc View Source

ToString()

Declaration
public override string ToString()
Returns
Type Description
System.String
Back to top Copyright © 2015-2016 Microsoft
Generated by DocFX