Example #1
0
 public bool Equals(ControlWord <T> other)
 {
     if (other == null)
     {
         return(false);
     }
     return(this.Name == other.Name &&
            this.Value?.Equals(other.Value) == true);
 }
Example #2
0
        public static ControlWord <bool> Negate(ControlWord <bool> word)
        {
            var type = word.GetType();

            if (!_factory.TryGetValue(type, out var factory))
            {
                var ctor      = type.GetConstructor(new[] { typeof(bool) });
                var boolParam = Expression.Parameter(typeof(bool), "value");
                factory        = (Func <bool, ControlWord <bool> >)Expression.Lambda(Expression.Convert(Expression.New(ctor, boolParam), typeof(ControlWord <bool>)), boolParam).Compile();
                _factory[type] = factory;
            }
            return(factory(!word.Value));
        }
Example #3
0
 public BorderToken(ControlWord <BorderPosition> side)
 {
     Side = side.Value;
 }