public void Create_some() { var expected = FSharpOptionHelper.Some(FSharpOptionHelper.GetUnderlyingType(TestData.PropertyType), "with data"); expected.Should().BeOfType <FSharpOption <string> >(); FSharpOption <string> .get_IsSome((FSharpOption <string>) expected).Should().BeTrue(); }
static void Main(string[] args) { var car = new Car(4, "Supacars", Tuple.Create(1.5, 3.5)); var bike = Vehicle.NewMotorbike("MyBike", 1.5); var motorcar = Vehicle.NewMotorcar(car); Functions.Describe(bike); Functions.Describe(motorcar); var someWheeledCar = Functions.CreateCar(4, "Supacars", 1.5, 3.5); var fourWheeledCar = Functions.CreateFourWheeledCar .Invoke("Supacars") .Invoke(1.5) .Invoke(3.5); // Working with Options var optionalCar = FSharpOption <Car> .Some(car); var isNone = FSharpOption <Car> .get_IsNone(optionalCar); var isNotSome = FSharpOption <Car> .get_IsSome(optionalCar); // With extension methods var optionalCarExt = car.AsOption(); var isNoneExt = optionalCarExt.IsNone(); var isSomeExt = optionalCarExt.IsSome(); }
public void SubtreeLookupTest3() { // initialize tree var t = setupTree(); // lookup a subtree using a mask not in the tree var key = UInt128.Zero; var mask = UInt128.calcMask(0, 3); var st_opt = t.LookupSubtree(key, mask); // the query should have returned a tree Assert.IsTrue(FSharpOption <CRTNode <string> > .get_IsSome(st_opt)); var st = st_opt.Value; // the returned tree should be an inner node with no value Assert.AreEqual(FSharpOption <string> .None, st.Value); // the returned tree should have a left subtree Assert.IsTrue(st.GetType() == typeof(CRTInner <string>)); var st_l = ((CRTInner <string>)st).Left; // the left subtree should be a leaf Assert.IsTrue(st_l.GetType() == typeof(CRTLeaf <string>)); // the left subtree value should be "hi!" var st_l_value = ((CRTLeaf <string>)st_l).Value; Assert.IsTrue(FSharpOption <string> .get_IsSome(st_l_value)); Assert.AreEqual("hi!", st_l_value.Value); }
public static FurtherTestingOutput FindCounterExamples(FurtherTestingInput input) { var log = new LogService(); try { IAnalyzer analyzer = new UIMain.Analyzer(); if (input.EnableLogging) { analyzer.LoggingOn(log); } else { analyzer.LoggingOff(); log.LogDebug("Logging is disabled."); } Stopwatch sw = new Stopwatch(); sw.Start(); var cexBifurcates = analyzer.findCExBifurcates(input.Model, input.Analysis); var cexCycles = analyzer.findCExCycles(input.Model, input.Analysis); var cexFixPoints = analyzer.findCExFixpoint(input.Model, input.Analysis); sw.Stop(); var cexs = new List <CounterExampleOutput>(); if (FSharpOption <BifurcationCounterExample> .get_IsSome(cexBifurcates)) { cexs.Add(cexBifurcates.Value); } if (FSharpOption <CycleCounterExample> .get_IsSome(cexCycles)) { cexs.Add(cexCycles.Value); } if (FSharpOption <FixPointCounterExample> .get_IsSome(cexFixPoints)) { cexs.Add(cexFixPoints.Value); } log.LogDebug(string.Format("Finding Counter Examples took {0} to run.", sw.Elapsed)); return(new FurtherTestingOutput { CounterExamples = cexs.ToArray(), ErrorMessages = log.ErrorMessages.Length > 0 ? log.ErrorMessages.ToArray() : null, DebugMessages = log.DebugMessages.Length > 0 ? log.DebugMessages.ToArray() : null }); } catch (Exception ex) { var version = typeof(Analysis).Assembly.GetName().Version; log.LogError(String.Format("Failed when looking for counter examples. Assembly version: {0}. Exception: {1}", version, ex)); return(new FurtherTestingOutput { Error = ex.Message, ErrorMessages = log.ErrorMessages.Length > 0 ? log.ErrorMessages.ToArray() : null, DebugMessages = log.DebugMessages.Length > 0 ? log.DebugMessages.ToArray() : null }); } }
public async Task <IPhysicalOperator <RowHolder> > BuildStatement(Sql.sqlStatement statement, ITransaction tran, IPhysicalOperator <RowHolder> source, InputStringNormalizer stringNormalizer) { if (statement.Joins.Any()) { IPhysicalOperator <RowHolder> currJoinSource = source; for (int i = 0; i < statement.Joins.Length; i++) { if (!statement.Joins[i].Item2.IsInner) { throw new NotSupportedException("Only inner join is supported at this point."); } MetadataTable joinRightTable = await this.metadataManager.GetTableManager().GetByName(statement.Joins[i].Item1, tran).ConfigureAwait(false); PhyOpScan scanOpRight = new PhyOpScan(joinRightTable.Collection, tran, joinRightTable.Columns, joinRightTable.TableName); Func <RowHolder, bool> filter = (_) => true; if (FSharpOption <Sql.where> .get_IsSome(statement.Joins[i].Item3)) { filter = FilterStatementBuilder.EvalWhere( statement.Joins[i].Item3.Value, QueryProcessingAccessors.MergeColumns(currJoinSource.GetOutputColumns(), scanOpRight.GetOutputColumns()), stringNormalizer); } currJoinSource = new PhyOpLoopInnerJoin(currJoinSource, scanOpRight, filter); } return(currJoinSource); } else { return(source); } }
static void Main(string[] args) { var car = new Car(4, "Supacars", Tuple.Create(1.5, 3.5)); var wheeles = car.Wheels; var bike = Vehicle.NewMotorbike("Harley", 4.0); var car2 = Vehicle.NewMotorcar(car); Console.WriteLine("A car: {0}", car); Console.WriteLine("A bike: {0}", bike); Functions.Describe(bike); Functions.Describe(car2); var car3 = Functions.CreateCar(4, "Chevy", 1.5, 3.5); var car4 = Functions.CreateFourWheeledCar .Invoke("Chevy") .Invoke(1.5) .Invoke(3.5); // Woring with Options var optionalCar = FSharpOption <Car> .Some(car); var isNone = FSharpOption <Car> .get_IsNone(car); var isNotSome = FSharpOption <Car> .get_IsSome(optionalCar); Console.WriteLine("{0} : {1} : {2}", optionalCar, isNone, isNotSome); }
public ShabbatDto(Shabbat.Occasion shabbat) { if (FSharpOption <string> .get_IsSome(shabbat.Id)) { Id = new ObjectId(shabbat.Id.Value); } Date = shabbat.Date; Title = shabbat.Title; Openings = shabbat.Openings.Select(o => new Opening(o)).ToList(); }
public void LookupTest2() { // initialize tree var t = setupTree(); // lookup a value; should be "all one or none!" var key = UInt128.Zero.Sub(UInt128.One); var value = t.Lookup(key); Assert.IsTrue(FSharpOption <string> .get_IsSome(value)); Assert.AreEqual("all one or none!", value.Value); }
public void LookupTest() { // initialize tree var t = setupTree(); // lookup a value; should be "hi!" var key = UInt128.FromZeroFilledPrefix("000010"); var value = t.Lookup(key); Assert.IsTrue(FSharpOption <string> .get_IsSome(value)); Assert.AreEqual("hi!", value.Value); }
public ShabbatModel(Parshiot.Reading reading) { Date = reading.Date; Title = reading.Title; Torah = reading.Leyning?.Torah; Maftir = FSharpOption <string> .get_IsSome(reading.Leyning?.Maftir) ? reading.Leyning?.Maftir?.Value : null; Haftarah = reading.Leyning?.Haftarah; Besorah = "N/A"; }
public Task <IPhysicalOperator <RowHolder> > BuildStatement(Sql.sqlStatement statement, ITransaction tran, IPhysicalOperator <RowHolder> source, InputStringNormalizer inputStringNormalizer) { if (FSharpOption <Sql.where> .get_IsSome(statement.Where)) { Sql.where whereStatement = statement.Where.Value; IPhysicalOperator <RowHolder> filterOp = new PhyOpFilter(source, FilterStatementBuilder.EvalWhere(whereStatement, source.GetOutputColumns(), inputStringNormalizer)); return(Task.FromResult(filterOp)); } else { return(Task.FromResult(source)); } }
public void FSharpConversion([Random(int.MinValue, int.MaxValue, 1)] int random) { var ourSome = new Option <int>(random); var fSharpSome = ourSome.ToFSharp(); Assert.That(FSharpOption <int> .get_IsSome(fSharpSome), "F# option should be some"); Assert.That(fSharpSome.Value, Is.EqualTo(random)); var ourNone = Option.Create <int>(); var fSharpNone = ourNone.ToFSharp(); Assert.That(FSharpOption <int> .get_IsNone(fSharpNone), "F# option should be None"); }
private void Restore() { var dir = SolutionExplorerExtensions.GetSolutionDirectory(); var dependencies = Dependencies.Locate(dir); var projects = SolutionExplorerExtensions.GetAllProjects() .Select(p => new { ProjectName = p.Name, ReferenceFile = ProjectFile.FindReferencesFile(new FileInfo(p.FullName)) }) .Where(p => FSharpOption <string> .get_IsSome(p.ReferenceFile)) .Select(p => new RestoringProject(p.ProjectName, p.ReferenceFile.Value)) .ToList(); restorer.Restore(dependencies, projects); }
public VortoRespondo?Vorto(string vorto) { var respondo = Indekso.GetValueOrDefault(vorto, null); if (respondo == null) { return(null); } var vorttipo = Sintaksanalizilo.infinitivoNomoDe(vorto).Value; var silaboj = Malinflektado.dividiKunFinaĵo(vorto); string?sintakso = null; if (respondo is Modifanto modifanto) { var sb = new StringBuilder(respondo.Vorto.Length); sb.AppendFormat("<v> {0}", modifanto.Vorto); sb.AppendJoin("", modifanto.AldonaĵajTipoj.Select((_, i) => $" <x<sub>{i}</sub>>")); sintakso = sb.ToString(); } if (silaboj.IsError) { throw new Exception(silaboj.ErrorValue); } var inflekcioj = Malinflektado.iujInflekciojDe(vorto); return(new VortoRespondo(respondo.Vorto) { Noto = respondo.Noto != null ? string.Format(respondo.Noto, "a<sub>1</sub>", "a<sub>2</sub>", "a<sub>3</sub>") : null, Radikoj = respondo.Radikoj.ToList(), Signifo = respondo.Signifo, Vorttipo = vorttipo, Silaboj = silaboj.ResultValue, Gloso = respondo.Gloso, InflektitajFormoj = FSharpOption <FSharpMap <Vorttipo.Inflekcio, string> > .get_IsSome(inflekcioj) ? inflekcioj.Value.Select(p => (p.Key.ToString(), p.Value)) .ToDictionary(p => p.Item1, p => p.Value) : null, Ujoj = respondo is Verbo verbo ? verbo.ArgumentajNotoj : null, FrazaSignifo = respondo is Verbo verbo2 ? string.Format(verbo2.FrazaSignifo, "a<sub>1</sub>", "a<sub>2</sub>", "a<sub>3</sub>") : null, Sintakso = sintakso, ModifeblajVorttipoj = respondo is Modifanto m?m.ModifeblajTipoj.Select(PriskribiVorttipanMallongaĵon) : null, AldonaĵajInflekcioj = respondo is Modifanto m2?m2.AldonaĵajTipoj.Select(PriskribiVorttipanMallongaĵon) : null, });
public static void SetContractInfo(ActiveContract activeContract, string contractCode) { try { var metadata = ContractExamples.Execution.metadata(contractCode); if (FSharpOption <ContractExamples.Execution.ContractMetadata> .get_IsSome(metadata)) { if (metadata.Value.IsCallOption) { var callOptionParameters = ((ContractExamples.Execution.ContractMetadata.CallOption)metadata.Value).Item; activeContract.Underlying = callOptionParameters.underlying; activeContract.Numeraire = callOptionParameters.numeraire; activeContract.Type = "call-option"; activeContract.Description = "Call Option"; activeContract.Premium = String.Format("{0:0.00#####}", callOptionParameters.price); activeContract.Strike = String.Format("{0:0.00#####}", callOptionParameters.strike); activeContract.Oracle = new Wallet.core.Data.Address(callOptionParameters.oracle, Wallet.core.Data.AddressType.Contract).ToString(); } else if (metadata.Value.IsOracle) { activeContract.Type = "oracle"; activeContract.Description = "Oracle"; } else if (metadata.Value.IsSecureToken) { activeContract.Type = "secure-token-generator"; activeContract.Description = "Secure Token Generator"; } else { activeContract.Type = ""; activeContract.Description = "Unrecognized"; } } else { activeContract.Type = "Unknown"; } } catch (Exception e) { activeContract.Type = "Error getting metadata"; } }
public void flagNext(Worksheet ws) { if (FSharpOption <ExceLint.CommonTypes.ProposedFix[]> .get_IsSome(_analysis.model.Fixes)) { var fixes = _analysis.model.Fixes.Value; if (currentFlag <= _analysis.model.Cutoff && currentFlag < fixes.Length) { // get fix var fix = fixes[currentFlag]; // don't update screen until done var initial_state = _app.ScreenUpdating; _app.ScreenUpdating = false; // restore colors ClearAllColors(ws); // paint source foreach (AST.Address a in fix.Source) { paintRed(a, 1.0); } // paint target foreach (AST.Address a in fix.Target) { paintColor(a, System.Drawing.Color.Green, true); } // don't update screen until done _app.ScreenUpdating = initial_state; // activate and center activateAndCenterOn(fix.Source.First(), _app); currentFlag++; } else { System.Windows.Forms.MessageBox.Show("No fixes remain."); restoreOutputColors(); setTool(active: false); currentFlag = 0; } } }
public void Parse_fsharp_option_string(string[] arguments, string expectedValue, bool expectedSome) { // Fixture setup in attributes // Exercize system var result = InvokeBuild <Options_With_FSharpOption>( arguments); // Verify outcome if (((Parsed <Options_With_FSharpOption>)result).Value.FileName != null) { expectedValue.Should().BeEquivalentTo(((Parsed <Options_With_FSharpOption>)result).Value.FileName.Value); } expectedSome.Should().Be(FSharpOption <string> .get_IsSome(((Parsed <Options_With_FSharpOption>)result).Value.FileName)); // Teardown }
public void Parse_fsharp_option_int(string[] arguments, int expectedValue, bool expectedSome) { // Fixture setup in attributes // Exercize system var result = InvokeBuild <Options_With_FSharpOption>( arguments); // Verify outcome if (((Parsed <Options_With_FSharpOption>)result).Value.Offset != null) { expectedValue.Should().Be(((Parsed <Options_With_FSharpOption>)result).Value.Offset.Value); } expectedSome.Should().Be(FSharpOption <int> .get_IsSome(((Parsed <Options_With_FSharpOption>)result).Value.Offset)); // Teardown }
public void SubtreeLookupTest() { // initialize tree var t = setupTree(); // lookup a subtree; should be the entire tree var zero = UInt128.Zero; var st_opt = t.LookupSubtree(zero, zero); // the query should have returned a tree Assert.IsTrue(FSharpOption <CRTNode <string> > .get_IsSome(st_opt)); var st = st_opt.Value; // the returned tree should be the root Assert.AreEqual(t, st); }
private SqlParameter[] CreateProductParameters(FundamentalProduct product) { string sparseXml = ""; //Creates sparse xml tags for all properties in the DetailSet that are not null. foreach (var property in product.DetailSet.GetType().GetProperties()) { //This is a hack, a dirty dirty hack, but it works! //To clarify: Gets the value from an F# Option-type if it is passed. Reflection within a reflection, refleception! if (property.PropertyType.IsGenericType && property.PropertyType.GetGenericTypeDefinition() == typeof(FSharpOption <>)) { object optionObj = (property.GetValue(product.DetailSet)); Type objType = optionObj.GetType(); object value = objType.GetProperty("Value").GetValue(optionObj); sparseXml += ColConvert.ToSparseXmlTag(value, property.Name); } else { sparseXml += ColConvert.ToSparseXmlTag(property.GetValue(product.DetailSet), property.Name); } } var parameters = new[] { new SqlParameter("@DataSource", product.DataSource), new SqlParameter("@SourceCode", FSharpOption <string> .get_IsSome(product.SourceCode) ? product.SourceCode.Value : null), new SqlParameter("@RequiredServiceID", FSharpOption <int> .get_IsSome(product.RequiredServiceID) ? product.RequiredServiceID.Value : (int?)null), new SqlParameter("@ProductCode", product.ProductCode), new SqlParameter("@ParentCode", FSharpOption <string> .get_IsSome(product.ParentCode) ? product.ParentCode.Value : null), new SqlParameter("@ProductDescription", product.ProductDescription), new SqlParameter("@ExpectedElementsPerDay", product.ExpectedElementsPerDay), new SqlParameter("@IsPublished", product.IsPublished), new SqlParameter("@RecTime", product.RecTime.DateTime), new SqlParameter("@MapData", FSharpOption <Geography> .get_IsSome(product.MapData) ? product.MapData.Value : null), new SqlParameter("@SQLTimeZoneName", FSharpOption <string> .get_IsSome(product.SQLTimeZoneName) ? product.SQLTimeZoneName.Value : null), //The following parameters are sparse. //Therefore they are represented as a XML string. new SqlParameter("@DetailSet", sparseXml) }; return(parameters); }
public void Parse_fsharp_option_int(string[] arguments, int expectedValue, bool expectedSome) { // Fixture setup in attributes // Exercize system var result = InstanceBuilder.Build( Maybe.Just <Func <FakeOptionsWithFSharpOption> >(() => new FakeOptionsWithFSharpOption()), arguments, StringComparer.Ordinal, CultureInfo.InvariantCulture); // Verify outcome if (((Parsed <FakeOptionsWithFSharpOption>)result).Value.Offset != null) { expectedValue.ShouldBeEquivalentTo(((Parsed <FakeOptionsWithFSharpOption>)result).Value.Offset.Value); } expectedSome.ShouldBeEquivalentTo(FSharpOption <int> .get_IsSome(((Parsed <FakeOptionsWithFSharpOption>)result).Value.Offset)); // Teardown }
public async Task Invoke(HttpContext context) { var suaveContext = await context.ToSuaveHttpContext(_preserveHttpHeaderCasing); var asyncWorkflow = _app.Invoke(suaveContext); var result = await FSharpAsync.StartAsTask( asyncWorkflow, FSharpOption<TaskCreationOptions>.Some(TaskCreationOptions.None), FSharpOption<CancellationToken>.Some(CancellationToken.None)); // Set the Suave result if the request could be handled by Suave if (FSharpOption<Http.HttpContext>.get_IsSome(result)) { await context.SetResponseFromSuaveResult(result.Value.response); } else { await _next.Invoke(context); } }
public void Parse_fsharp_option_string(string[] arguments, string expectedValue, bool expectedSome) { // Fixture setup in attributes // Exercize system var result = InstanceBuilder.Build( Maybe.Just <Func <Options_With_FSharpOption> >(() => new Options_With_FSharpOption()), arguments, StringComparer.Ordinal, CultureInfo.InvariantCulture, Enumerable.Empty <ErrorType>()); // Verify outcome if (((Parsed <Options_With_FSharpOption>)result).Value.FileName != null) { expectedValue.ShouldBeEquivalentTo(((Parsed <Options_With_FSharpOption>)result).Value.FileName.Value); } expectedSome.ShouldBeEquivalentTo(FSharpOption <string> .get_IsSome(((Parsed <Options_With_FSharpOption>)result).Value.FileName)); // Teardown }
byte[] GetContractCode(byte[] contractHash) { using (TransactionContext dbTx = _DBContext.GetTransactionContext()) { var result = ContractsTxsStore.Get(dbTx.Transaction, contractHash); if (result != null && BlockStore.TxStore.ContainsKey(dbTx, result)) { var transaction = BlockStore.TxStore.Get(dbTx, result).Value; if (FSharpOption <Types.ExtendedContract> .get_IsSome(transaction.Tx.contract)) { if (transaction.Tx.contract.Value.IsContract) { return((transaction.Tx.contract.Value as Types.ExtendedContract.Contract).Item.code); } } } } return(null); }
public CalculatedProductDto Calculate(string name, int upc, decimal productPrice, int tax, int?universalDiscount, UpcDiscountDto upcDiscount) { var universalDiscountOption = universalDiscount.HasValue ? FSharpOption <PriceCalculations.Discount> .Some(PriceCalculations.Discount.NewDiscount(universalDiscount.Value)) : FSharpOption <PriceCalculations.Discount> .None; var upcDiscountOption = upcDiscount != null ? FSharpOption <PriceCalculations.UpcDiscount> .Some(new PriceCalculations.UpcDiscount( PriceCalculations.Discount.NewDiscount(upcDiscount.Discount), ProductUpc.NewProductUpc(upcDiscount.Upc))) : FSharpOption <PriceCalculations.UpcDiscount> .None; Say.hello("from Say module"); var pr = new Product( ProductName.NewProductName(name), ProductUpc.NewProductUpc(upc), ProductPriceModule.create(productPrice)); var priceCalculationDto = PriceCalculations.calculatePrice( PriceCalculations.Tax.NewTax(tax), universalDiscountOption, upcDiscountOption, pr); return(new CalculatedProductDto(priceCalculationDto.upc.Item, name, ProductPriceModule.value(priceCalculationDto.basePrice), ProductPriceModule.value(priceCalculationDto.taxAmount), FSharpOption <ProductPrice> .get_IsSome(priceCalculationDto.universalDiscountAmount) ? ProductPriceModule.value(priceCalculationDto.universalDiscountAmount.Value) as decimal? : null, FSharpOption <ProductPrice> .get_IsSome(priceCalculationDto.upcDiscountAmount) ? ProductPriceModule.value(priceCalculationDto.upcDiscountAmount.Value) as decimal? : null, FSharpOption <ProductPrice> .get_IsSome(priceCalculationDto.totalDiscountAmount) ? ProductPriceModule.value(priceCalculationDto.totalDiscountAmount.Value) as decimal? : null, ProductPriceModule.value(priceCalculationDto.calculatedPrice))); }
public async Task <IEnumerable <(Watermark, DateTimeOffset)> > GetOldSnapshots(TimeSpan maxAge, CancellationToken cancellationToken) { var blobs = this.snapshotContainerClient.GetBlobsAsync(traits: BlobTraits.Metadata, cancellationToken: cancellationToken); var items = new List <(Watermark, DateTimeOffset)>(); await foreach (var blob in blobs) { var someUpdateWatermark = ParseWatermarkFromBlobName(blob.Name); if (FSharpOption <Watermark> .get_IsSome(someUpdateWatermark) && blob.Properties.LastModified.HasValue && blob.Properties.LastModified.Value < DateTime.UtcNow.Subtract(maxAge)) { var v = (someUpdateWatermark.Value, blob.Properties.LastModified.Value); items.Add(v); } } return(items .OrderBy(i => i.Item2) .Where(i => i.Item1.Item % 10 == 0) .SkipLast(10)); }
public async Task Invoke(HttpContext context) { try { await _next(context); } catch (Exception ex) { try { var suaveContext = await context.ToSuaveHttpContext(_preserveHttpHeaderCasing); var asyncWorkflow = _errorHandler.Invoke(ex).Invoke("").Invoke(suaveContext); var result = await FSharpAsync.StartAsTask( asyncWorkflow, FSharpOption <TaskCreationOptions> .Some(TaskCreationOptions.None), FSharpOption <CancellationToken> .Some(CancellationToken.None)); // Set the Suave result if the request could be handled by Suave and return if (FSharpOption <Http.HttpContext> .get_IsSome(result)) { await context.SetResponseFromSuaveResult(result.Value.response); return; } } catch (Exception ex2) { _logger.LogError(0, ex, $"An unhandled exception has occured: {ex.Message}."); _logger.LogError(0, ex2, $"An exception was thrown attempting to execute the error handler: {ex2.Message}."); } // Re -throw the original exception throw; } }
public override int Serialize(ref byte[] bytes, int offset, FSharpOption <T> value) { var len = GetLength(); if (len != null) { BinaryUtil.EnsureCapacity(ref bytes, offset, len.Value); } var isSome = FSharpOption <T> .get_IsSome(value); BinaryUtil.WriteBoolean(ref bytes, offset, isSome); if (isSome) { var startOffset = offset; offset += 1; offset += innerFormatter.Serialize(ref bytes, offset, value.Value); return(offset - startOffset); } else { return(1); } }
private async Task <FSharpOption <(Watermark, string)> > GetLatestSnapshotID(CancellationToken cancellationToken) { var names = await this.GetBlobNames(cancellationToken); var items = new List <(Watermark, string)>(); foreach (var name in names) { var someUpdateWatermark = ParseWatermarkFromBlobName(name); if (FSharpOption <Watermark> .get_IsSome(someUpdateWatermark)) { var v = (someUpdateWatermark.Value, name); items.Add(v); } } if (items.Count == 0) { return(FSharpOption <(Watermark, string)> .None); } return(FSharpOption <(Watermark, string)> .Some(items.OrderByDescending(_ => _.Item1).First())); }
public static bool IsSome <T>(this FSharpOption <T> option) { return(FSharpOption <T> .get_IsSome(option)); }