Class SugarStruct
Inheritance
System.Object
SugarStruct
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: LibSugar.dll
Syntax
public static class SugarStruct
Methods
|
Improve this Doc
View Source
AssertNonNull<T>(Nullable<T>)
Declaration
public static T AssertNonNull<T>(this T? v)
where T : struct
Parameters
Type |
Name |
Description |
System.Nullable<T> |
v |
|
Returns
Type Parameters
|
Improve this Doc
View Source
AssertNull<T>(Nullable<T>)
Declaration
public static T? AssertNull<T>(this T? v)
where T : struct
Parameters
Type |
Name |
Description |
System.Nullable<T> |
v |
|
Returns
Type |
Description |
System.Nullable<T> |
|
Type Parameters
|
Improve this Doc
View Source
Swap<T>(ref T, T)
Declaration
public static T Swap<T>(this ref T self, T newValue)
where T : struct
Parameters
Type |
Name |
Description |
T |
self |
|
T |
newValue |
|
Returns
Type Parameters
|
Improve this Doc
View Source
Swap<T>(ref T, in T)
Declaration
public static T Swap<T>(this ref T self, in T newValue)
where T : struct
Parameters
Type |
Name |
Description |
T |
self |
|
T |
newValue |
|
Returns
Type Parameters
|
Improve this Doc
View Source
TryDequeue<T>(ConcurrentQueue<T>)
Declaration
public static T? TryDequeue<T>(this ConcurrentQueue<T> self)
where T : struct
Parameters
Type |
Name |
Description |
System.Collections.Concurrent.ConcurrentQueue<T> |
self |
|
Returns
Type |
Description |
System.Nullable<T> |
|
Type Parameters
|
Improve this Doc
View Source
TryDequeue<T>(Queue<T>)
Declaration
public static T? TryDequeue<T>(this Queue<T> self)
where T : struct
Parameters
Type |
Name |
Description |
System.Collections.Generic.Queue<T> |
self |
|
Returns
Type |
Description |
System.Nullable<T> |
|
Type Parameters
|
Improve this Doc
View Source
TryFirst<T>(IEnumerable<T>)
Declaration
public static T? TryFirst<T>(this IEnumerable<T> self)
where T : struct
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<T> |
self |
|
Returns
Type |
Description |
System.Nullable<T> |
|
Type Parameters
|
Improve this Doc
View Source
TryGet<T>(Option<T>)
Declaration
public static T? TryGet<T>(this Option<T> self)
where T : struct
Parameters
Type |
Name |
Description |
Option<T> |
self |
|
Returns
Type |
Description |
System.Nullable<T> |
|
Type Parameters
|
Improve this Doc
View Source
TryGet<T>(in ReadOnlySequence<T>, ref SequencePosition, Boolean)
Declaration
public static ReadOnlyMemory<T>? TryGet<T>(this in ReadOnlySequence<T> self, ref SequencePosition position, bool advance = true)
where T : struct
Parameters
Type |
Name |
Description |
System.Buffers.ReadOnlySequence<T> |
self |
|
System.SequencePosition |
position |
|
System.Boolean |
advance |
|
Returns
Type |
Description |
System.Nullable<System.ReadOnlyMemory<T>> |
|
Type Parameters
|
Improve this Doc
View Source
TryGet<T>(HashSet<T>, T)
Declaration
public static T? TryGet<T>(this HashSet<T> self, T key)
where T : struct
Parameters
Type |
Name |
Description |
System.Collections.Generic.HashSet<T> |
self |
|
T |
key |
|
Returns
Type |
Description |
System.Nullable<T> |
|
Type Parameters
|
Improve this Doc
View Source
TryGet<T, E>(Result<T, E>)
Declaration
public static T? TryGet<T, E>(this Result<T, E> self)
where T : struct
Parameters
Type |
Name |
Description |
Result<T, E> |
self |
|
Returns
Type |
Description |
System.Nullable<T> |
|
Type Parameters
|
Improve this Doc
View Source
TryGet<K, V>(ConcurrentDictionary<K, V>, K)
Declaration
public static V? TryGet<K, V>(this ConcurrentDictionary<K, V> self, K key)
where V : struct
Parameters
Type |
Name |
Description |
System.Collections.Concurrent.ConcurrentDictionary<K, V> |
self |
|
K |
key |
|
Returns
Type |
Description |
System.Nullable<V> |
|
Type Parameters
|
Improve this Doc
View Source
TryGet<K, V>(Dictionary<K, V>, K)
Declaration
public static V? TryGet<K, V>(this Dictionary<K, V> self, K key)
where V : struct
Parameters
Type |
Name |
Description |
System.Collections.Generic.Dictionary<K, V> |
self |
|
K |
key |
|
Returns
Type |
Description |
System.Nullable<V> |
|
Type Parameters
|
Improve this Doc
View Source
TryGet<K, V>(IDictionary<K, V>, K)
Declaration
public static V? TryGet<K, V>(this IDictionary<K, V> self, K key)
where V : struct
Parameters
Type |
Name |
Description |
System.Collections.Generic.IDictionary<K, V> |
self |
|
K |
key |
|
Returns
Type |
Description |
System.Nullable<V> |
|
Type Parameters
|
Improve this Doc
View Source
TryGet<K, V>(IReadOnlyDictionary<K, V>, K)
Declaration
public static V? TryGet<K, V>(this IReadOnlyDictionary<K, V> self, K key)
where V : struct
Parameters
Type |
Name |
Description |
System.Collections.Generic.IReadOnlyDictionary<K, V> |
self |
|
K |
key |
|
Returns
Type |
Description |
System.Nullable<V> |
|
Type Parameters
|
Improve this Doc
View Source
TryGet<K, V>(SortedDictionary<K, V>, K)
Declaration
public static V? TryGet<K, V>(this SortedDictionary<K, V> self, K key)
where V : struct
Parameters
Type |
Name |
Description |
System.Collections.Generic.SortedDictionary<K, V> |
self |
|
K |
key |
|
Returns
Type |
Description |
System.Nullable<V> |
|
Type Parameters
|
Improve this Doc
View Source
TryGet<K, V>(SortedList<K, V>, K)
Declaration
public static V? TryGet<K, V>(this SortedList<K, V> self, K key)
where V : struct
Parameters
Type |
Name |
Description |
System.Collections.Generic.SortedList<K, V> |
self |
|
K |
key |
|
Returns
Type |
Description |
System.Nullable<V> |
|
Type Parameters
|
Improve this Doc
View Source
TryGet<K, V>(KeyedCollection<K, V>, K)
Declaration
public static V? TryGet<K, V>(this KeyedCollection<K, V> self, K key)
where V : struct
Parameters
Type |
Name |
Description |
System.Collections.ObjectModel.KeyedCollection<K, V> |
self |
|
K |
key |
|
Returns
Type |
Description |
System.Nullable<V> |
|
Type Parameters
|
Improve this Doc
View Source
TryGet<K, V>(ReadOnlyDictionary<K, V>, K)
Declaration
public static V? TryGet<K, V>(this ReadOnlyDictionary<K, V> self, K key)
where V : struct
Parameters
Type |
Name |
Description |
System.Collections.ObjectModel.ReadOnlyDictionary<K, V> |
self |
|
K |
key |
|
Returns
Type |
Description |
System.Nullable<V> |
|
Type Parameters
|
Improve this Doc
View Source
TryGetError<T, E>(Result<T, E>)
Declaration
public static E? TryGetError<T, E>(this Result<T, E> self)
where E : struct
Parameters
Type |
Name |
Description |
Result<T, E> |
self |
|
Returns
Type |
Description |
System.Nullable<E> |
|
Type Parameters
|
Improve this Doc
View Source
TryPeek<T>(ConcurrentBag<T>)
Declaration
public static T? TryPeek<T>(this ConcurrentBag<T> self)
where T : struct
Parameters
Type |
Name |
Description |
System.Collections.Concurrent.ConcurrentBag<T> |
self |
|
Returns
Type |
Description |
System.Nullable<T> |
|
Type Parameters
|
Improve this Doc
View Source
TryPeek<T>(ConcurrentQueue<T>)
Declaration
public static T? TryPeek<T>(this ConcurrentQueue<T> self)
where T : struct
Parameters
Type |
Name |
Description |
System.Collections.Concurrent.ConcurrentQueue<T> |
self |
|
Returns
Type |
Description |
System.Nullable<T> |
|
Type Parameters
|
Improve this Doc
View Source
TryPeek<T>(ConcurrentStack<T>)
Declaration
public static T? TryPeek<T>(this ConcurrentStack<T> self)
where T : struct
Parameters
Type |
Name |
Description |
System.Collections.Concurrent.ConcurrentStack<T> |
self |
|
Returns
Type |
Description |
System.Nullable<T> |
|
Type Parameters
|
Improve this Doc
View Source
TryPeek<T>(Queue<T>)
Declaration
public static T? TryPeek<T>(this Queue<T> self)
where T : struct
Parameters
Type |
Name |
Description |
System.Collections.Generic.Queue<T> |
self |
|
Returns
Type |
Description |
System.Nullable<T> |
|
Type Parameters
|
Improve this Doc
View Source
TryPeek<T>(Stack<T>)
Declaration
public static T? TryPeek<T>(this Stack<T> self)
where T : struct
Parameters
Type |
Name |
Description |
System.Collections.Generic.Stack<T> |
self |
|
Returns
Type |
Description |
System.Nullable<T> |
|
Type Parameters
|
Improve this Doc
View Source
TryPop<T>(ConcurrentStack<T>)
Declaration
public static T? TryPop<T>(this ConcurrentStack<T> self)
where T : struct
Parameters
Type |
Name |
Description |
System.Collections.Concurrent.ConcurrentStack<T> |
self |
|
Returns
Type |
Description |
System.Nullable<T> |
|
Type Parameters
|
Improve this Doc
View Source
TryPop<T>(Stack<T>)
Declaration
public static T? TryPop<T>(this Stack<T> self)
where T : struct
Parameters
Type |
Name |
Description |
System.Collections.Generic.Stack<T> |
self |
|
Returns
Type |
Description |
System.Nullable<T> |
|
Type Parameters
|
Improve this Doc
View Source
TryRemove<K, V>(ConcurrentDictionary<K, V>, K)
Declaration
public static V? TryRemove<K, V>(this ConcurrentDictionary<K, V> self, K key)
where V : struct
Parameters
Type |
Name |
Description |
System.Collections.Concurrent.ConcurrentDictionary<K, V> |
self |
|
K |
key |
|
Returns
Type |
Description |
System.Nullable<V> |
|
Type Parameters
|
Improve this Doc
View Source
TryTake<T>(BlockingCollection<T>)
Declaration
public static T? TryTake<T>(this BlockingCollection<T> self)
where T : struct
Parameters
Type |
Name |
Description |
System.Collections.Concurrent.BlockingCollection<T> |
self |
|
Returns
Type |
Description |
System.Nullable<T> |
|
Type Parameters
|
Improve this Doc
View Source
TryTake<T>(BlockingCollection<T>, Int32)
Declaration
public static T? TryTake<T>(this BlockingCollection<T> self, int millisecondsTimeout)
where T : struct
Parameters
Type |
Name |
Description |
System.Collections.Concurrent.BlockingCollection<T> |
self |
|
System.Int32 |
millisecondsTimeout |
|
Returns
Type |
Description |
System.Nullable<T> |
|
Type Parameters
|
Improve this Doc
View Source
TryTake<T>(BlockingCollection<T>, Int32, CancellationToken)
Declaration
public static T? TryTake<T>(this BlockingCollection<T> self, int millisecondsTimeout, CancellationToken cancellationToken)
where T : struct
Parameters
Type |
Name |
Description |
System.Collections.Concurrent.BlockingCollection<T> |
self |
|
System.Int32 |
millisecondsTimeout |
|
System.Threading.CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
System.Nullable<T> |
|
Type Parameters
|
Improve this Doc
View Source
TryTake<T>(BlockingCollection<T>, TimeSpan)
Declaration
public static T? TryTake<T>(this BlockingCollection<T> self, TimeSpan timeout)
where T : struct
Parameters
Type |
Name |
Description |
System.Collections.Concurrent.BlockingCollection<T> |
self |
|
System.TimeSpan |
timeout |
|
Returns
Type |
Description |
System.Nullable<T> |
|
Type Parameters
|
Improve this Doc
View Source
TryTake<T>(ConcurrentBag<T>)
Declaration
public static T? TryTake<T>(this ConcurrentBag<T> self)
where T : struct
Parameters
Type |
Name |
Description |
System.Collections.Concurrent.ConcurrentBag<T> |
self |
|
Returns
Type |
Description |
System.Nullable<T> |
|
Type Parameters