From 0f9ef005f063198ea2e16ca36beaead4bd5e3824 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 14 Apr 2016 21:12:07 +0100 Subject: Add .NET output --- dotnet/Mammoth/Couscous/mammoth/internal/util/Casts.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 dotnet/Mammoth/Couscous/mammoth/internal/util/Casts.cs (limited to 'dotnet/Mammoth/Couscous/mammoth/internal/util/Casts.cs') diff --git a/dotnet/Mammoth/Couscous/mammoth/internal/util/Casts.cs b/dotnet/Mammoth/Couscous/mammoth/internal/util/Casts.cs new file mode 100644 index 0000000..c342e20 --- /dev/null +++ b/dotnet/Mammoth/Couscous/mammoth/internal/util/Casts.cs @@ -0,0 +1,13 @@ +using Mammoth.Couscous.java.util; + +namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.util { + internal static class Casts { + internal static Optional tryCast(System.Type type, object value) { + if (value is T) { + return new Some((T) value); + } else { + return new None(); + } + } + } +} -- cgit v1.2.3