aboutsummaryrefslogtreecommitdiff
path: root/dotnet/Mammoth/Couscous/mammoth/internal/util/Casts.cs
diff options
context:
space:
mode:
Diffstat (limited to 'dotnet/Mammoth/Couscous/mammoth/internal/util/Casts.cs')
-rw-r--r--dotnet/Mammoth/Couscous/mammoth/internal/util/Casts.cs13
1 files changed, 13 insertions, 0 deletions
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<T> tryCast<T>(System.Type type, object value) {
+ if (value is T) {
+ return new Some<T>((T) value);
+ } else {
+ return new None<T>();
+ }
+ }
+ }
+}