public static V Max <K, V>(this Series <K, V> series) { Series <K, V> series1 = series; FSharpFunc <V, FSharpFunc <V, V> > fsharpFunc = (FSharpFunc <V, FSharpFunc <V, V> >) new SeriesStatsExtensions.Max <V>(); Series <K, V> series2 = series1; V v = default(V); bool flag = false; IEnumerator <OptionalValue <V> > enumerator = FVectorextensionscore.IVector ` 1get_DataSequence < V > (series2.Vector).GetEnumerator(); try { while (enumerator.MoveNext()) { OptionalValue <V> current = enumerator.Current; if (current.HasValue) { v = !flag ? current.Value : (V)FSharpFunc <V, V> .InvokeFast <V>((FSharpFunc <V, FSharpFunc <V, M0> >) fsharpFunc, v, current.Value); flag = true; } } } finally { (enumerator as IDisposable)?.Dispose(); } return((V)OptionModule.GetValue <V>(!flag ? (FSharpOption <M0>)null : (FSharpOption <M0>)FSharpOption <V> .Some(v))); }
/// <summary> /// Gets the value for supplied optional. /// Will raise exception if None. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="optional">Input optional container.</param> /// <returns>Contained value in optional, if it exists.</returns> public static T Get <T>(FSharpOption <T> optional) { return(OptionModule.GetValue <T>(optional)); }