美文网首页
About Method Of C#

About Method Of C#

作者: 何三岁_ | 来源:发表于2018-06-07 10:37 被阅读0次

About how to use method of Csharp.

For illustrate,The code is as follows:

using System;
namespace UseMethod
{
       class program
      {
            static void Main (string[] args)
            {
                  double GetHeight;
                  double GetWidth;
                  GetHeight = Convert.ToDouble(Console.ReadLine());
                  GetWidth  = Convert.ToDouble(Console.ReadLine());
                  GetHeight = Convert.ToDouble(GetHeight);
                  GetWidth  = Convert.ToDouble(GetWidth);
                  //this is simple call method demo.
                  Console.WriteLine(RectangleArea(GetHeight,GetWidth));
                  Console.ReadKey();  
            }  
            static double RectangleArea(double height, double width)
            {
                  return Convert.ToDouble(height*width);
            }
      }
}

In this segments code,Involve console get to Double Type.Please refer to details: https://blog.csdn.net/yushaopu/article/details/52065833
We could saw,If you want declare a Method,Must include acceess modifier(static public private)、returned value(short char int double long void )、method name、parameter list(int double short ...)and method body,As follows:

<Access Specifier> <Return Type> <Method Name>(Parameter List)
{
    Method Body
}

相关文章

网友评论

      本文标题:About Method Of C#

      本文链接:https://www.haomeiwen.com/subject/nrgwsftx.html