예제 #1
0
            public DebuggerTypeProxy(OneOf <T1, T2> value)
            {
                switch (value.which)
                {
                case 1:
                    Display = value.item1;
                    break;

                case 2:
                    Display = value.item2;
                    break;

                default:
                    throw CreateInvalidStateException();
                }
            }
예제 #2
0
        public bool Equals(OneOf <T1, T2> other)
        {
            if (which != other.which)
            {
                return(false);
            }
            switch (which)
            {
            case 1:
                return(EqualityComparer <T1> .Default.Equals(item1, other.item1));

            case 2:
                return(EqualityComparer <T2> .Default.Equals(item2, other.item2));

            default:
                throw CreateInvalidStateException();
            }
        }