aboutsummaryrefslogtreecommitdiff
path: root/Mammoth/Couscous/mammoth/internal/util/Casts.cs
blob: 29af07a44c1a7a394e409076e9e8a7ec77ec2df4 (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 None<T>.Instance;
            }
        }
    }
}