aboutsummaryrefslogtreecommitdiff
path: root/dotnet/Mammoth/Couscous/mammoth/internal/util/Casts.cs
blob: c342e20f2b1a1b66b95d3e37d43ae53a7e8d1a75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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>();
            }
        }
    }
}