public static AlwaysTrue FetchOrAdd(Contract contract)
 {
     // Fetch the AlwaysTrue wrapper
     IEnumerable<ContractParameter> parameters = contract.AllParameters.Where<ContractParameter>(p => p.GetType() == typeof(AlwaysTrue));
     if (parameters.Count() == 0)
     {
         AlwaysTrue alwaysTrue = new AlwaysTrue();
         contract.AddParameter(alwaysTrue);
         return alwaysTrue;
     }
     else
     {
         return parameters.First() as AlwaysTrue;
     }
 }
示例#2
0
        public static AlwaysTrue FetchOrAdd(Contract contract)
        {
            // Fetch the AlwaysTrue wrapper
            IEnumerable <ContractParameter> parameters = contract.AllParameters.Where <ContractParameter>(p => p.GetType() == typeof(AlwaysTrue));

            if (parameters.Count() == 0)
            {
                AlwaysTrue alwaysTrue = new AlwaysTrue();
                contract.AddParameter(alwaysTrue);
                return(alwaysTrue);
            }
            else
            {
                return(parameters.First() as AlwaysTrue);
            }
        }