Skip to content

Commit

Permalink
console sample
Browse files Browse the repository at this point in the history
  • Loading branch information
pimbrouwers committed Aug 30, 2024
1 parent e9ad934 commit 1c4ec8c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions samples/Console/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Danom;

public static class OptionSamples
{
private static readonly IEnumerable<int> _store = Enumerable.Range(1, 100);

public static Option<int> TryFindInt(Func<int, bool> predicate) =>
_store.FirstOrDefault(predicate).ToOption();

public static void Test()
{
if (Option<int>.Some(1).DefaultValue(1) == 1)
{
Console.WriteLine("Some");
}
}
}

// write main method
public static class Program
{
public static void Main()
{
OptionSamples.Test();
}
}

0 comments on commit 1c4ec8c

Please sign in to comment.