当前位置: 首页>>代码示例>>C#>>正文


C# Foo.renamed1arg方法代码示例

本文整理汇总了C#中Foo.renamed1arg方法的典型用法代码示例。如果您正苦于以下问题:C# Foo.renamed1arg方法的具体用法?C# Foo.renamed1arg怎么用?C# Foo.renamed1arg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Foo的用法示例。


在下文中一共展示了Foo.renamed1arg方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

    static void Main() 
    {
      if (default_args.anonymous() != 7771)
        throw new Exception("anonymous (1) failed");
      if (default_args.anonymous(1234) != 1234)
        throw new Exception("anonymous (2) failed");

      if (default_args.booltest() != true)
        throw new Exception("booltest (1) failed");
      if (default_args.booltest(true) != true)
        throw new Exception("booltest (2) failed");
      if (default_args.booltest(false) != false)
        throw new Exception("booltest (3) failed");

      EnumClass ec = new EnumClass();
      if (ec.blah() != true)
        throw new Exception("EnumClass failed");

      if (default_args.casts1() != null)
        throw new Exception("casts1 failed");

      if (default_args.casts2() != "Hello")
        throw new Exception("casts2 failed");

      if (default_args.casts1("Ciao") != "Ciao")
        throw new Exception("casts1 not default failed");

      if (default_args.chartest1() != 'x')
        throw new Exception("chartest1 failed");

      if (default_args.chartest2() != '\0')
        throw new Exception("chartest2 failed");

      if (default_args.chartest1('y') != 'y')
        throw new Exception("chartest1 not default failed");

      if (default_args.chartest1('y') != 'y')
        throw new Exception("chartest1 not default failed");

      if (default_args.reftest1() != 42)
        throw new Exception("reftest1 failed");

      if (default_args.reftest1(400) != 400)
        throw new Exception("reftest1 not default failed");

      if (default_args.reftest2() != "hello")
        throw new Exception("reftest2 failed");

      // rename
      Foo foo = new Foo();
      foo.newname(); 
      foo.newname(10); 
      foo.renamed3arg(10, 10.0); 
      foo.renamed2arg(10); 
      foo.renamed1arg(); 

      // exception specifications
      try {
        default_args.exceptionspec();
        throw new Exception("exceptionspec 1 failed");
      } catch (Exception) {
      }
      try {
        default_args.exceptionspec(-1);
        throw new Exception("exceptionspec 2 failed");
      } catch (Exception) {
      }
      try {
        default_args.exceptionspec(100);
        throw new Exception("exceptionspec 3 failed");
      } catch (Exception) {
      }
      Except ex = new Except(false);
      try {
        ex.exspec();
        throw new Exception("exspec 1 failed");
      } catch (Exception) {
      }
      try {
        ex.exspec(-1);
        throw new Exception("exspec 2 failed");
      } catch (Exception) {
      }
      try {
        ex.exspec(100);
        throw new Exception("exspec 3 failed");
      } catch (Exception) {
      }
      try {
        ex = new Except(true);
        throw new Exception("Except constructor 1 failed");
      } catch (Exception) {
      }
      try {
        ex = new Except(true, -2);
        throw new Exception("Except constructor 2 failed");
      } catch (Exception) {
      }

      // Default parameters in static class methods
//.........这里部分代码省略.........
开发者ID:Reticulatas,项目名称:MochaEngineFinal,代码行数:101,代码来源:default_args_runme.cs


注:本文中的Foo.renamed1arg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。