コード例 #1
0
        private void OptionalParameters()
        {
            // old
            var nop = new Named_OptionalParameters();

            nop.Process("foo", false, null);
            nop.Process("foo", false);
            nop.Process("foo");

            ArrayList myArrayList = new ArrayList();

            nop.Process_New("foo", false, myArrayList);
            nop.Process_New("foo", true);
            nop.Process_New("foo");
        }
コード例 #2
0
        private void NamedParameters()
        {
            var       nop         = new Named_OptionalParameters();
            ArrayList myArrayList = new ArrayList();


            // nop.Process("foo", myArrayList); // Invalid!

            nop.Process_New("foo", true);                                   // valid, moreData omitted
            nop.Process_New("foo", true, myArrayList);                      // valid
            nop.Process_New("foo", moreData: myArrayList);                  // valid, ignoreWS omitted
            nop.Process_New("foo", moreData: myArrayList, ignoreWS: false); // valid, but silly

            //Named argument specifications must appear after all fixed arguments have been specified.
            // nop.Process_New("foo", ignoreWS: false, myArrayList); // valid, but silly
        }