OptionExtensionsLinqGet Method

Overload List

GetT(T, Int32) Returns Some of the element at the given index of the array if it is a valid index; None otherwise.
C#
Assert(Array.Empty<Title>().Get(1).IsNone);
Assert((new int[2] { 1, 2 }).Get(2) == Some(1));
Assert((new int[2] { 1, 2 }).Get(0) == Some(1));
GetT(MemoryT, Void) 
GetT(ReadOnlyMemoryT, Void) 
GetT(ReadOnlySpanT, Void) 
GetT(SpanT, Void) 
GetK, V(DictionaryTKey, TValue, Boolean) 
GetT, L(L, Int32) Returns Some of the element at the given index of the list if it is a valid index; None otherwise.
C#
Assert(Array.Empty<Title>().Get(1).IsNone);
Assert((new List<int>() { 1, 2 }).Get(2) == Some(1));
Assert((new List<int>() { 1, 2 }).Get(0) == Some(1));

See Also