Struct ReadAttempt<T>
- Namespace
- CStructSharp.Values
- Assembly
- CStructSharp.dll
The outcome of an awaitable TryReadValueAsync<T> (an out parameter cannot cross an
await): either Value with Succeeded set, or the categorized
Failure the throwing form would have raised. Cancellation and argument errors are not outcomes;
they throw as they do everywhere else.
public readonly struct ReadAttempt<T> : IEquatable<ReadAttempt<T>>
Type Parameters
TThe requested value type.
- Implements
- Inherited Members
Constructors
ReadAttempt(bool, T?, CStructException?)
The outcome of an awaitable TryReadValueAsync<T> (an out parameter cannot cross an
await): either Value with Succeeded set, or the categorized
Failure the throwing form would have raised. Cancellation and argument errors are not outcomes;
they throw as they do everywhere else.
public ReadAttempt(bool Succeeded, T? Value, CStructException? Failure)
Parameters
SucceededboolWhether the read produced a value.
ValueTThe value when
Succeededis true; otherwise the default.FailureCStructExceptionThe read, path, or limit failure when
Succeededis false; otherwise null.
Properties
Failure
public CStructException? Failure { get; init; }
Property Value
Succeeded
Whether the read produced a value.
public bool Succeeded { get; init; }
Property Value
Value
The value when Succeeded is true; otherwise the default.
public T? Value { get; init; }
Property Value
- T
Methods
Deconstruct(out bool, out T?, out CStructException?)
public void Deconstruct(out bool Succeeded, out T? Value, out CStructException? Failure)
Parameters
SucceededboolValueTFailureCStructException
Equals(ReadAttempt<T>)
public bool Equals(ReadAttempt<T> other)
Parameters
otherReadAttempt<T>
Returns
Equals(object)
public override bool Equals(object obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
ToString()
public override string ToString()
Returns
Operators
operator ==(ReadAttempt<T>, ReadAttempt<T>)
public static bool operator ==(ReadAttempt<T> left, ReadAttempt<T> right)
Parameters
leftReadAttempt<T>rightReadAttempt<T>
Returns
operator !=(ReadAttempt<T>, ReadAttempt<T>)
public static bool operator !=(ReadAttempt<T> left, ReadAttempt<T> right)
Parameters
leftReadAttempt<T>rightReadAttempt<T>