Пример #1
0
        public int Switch_ViaMethodReturnValue(SomeOtherClass so)
        {
            Contract.Requires(so != null);
            var i = 0;

            var e = so.ReturnAnEnumValue();

            switch (e)
            {
            case MyEnum.One:
                i += 1;
                break;

            case MyEnum.Two:
                i += 2;
                break;

            default:
                throw Helper.FailedAssertion();
            }

            return(i);
        }
Пример #2
0
    public int Switch_ViaMethodReturnValue(SomeOtherClass so)
    {
      Contract.Requires(so != null);
      var i = 0;

      var e = so.ReturnAnEnumValue();

      switch (e)
      {
        case MyEnum.One:
          i += 1;
          break;

        case MyEnum.Two:
          i += 2;
          break;

        default:
          throw Helper.FailedAssertion();
      }

      return i;
    }