码迷,mamicode.com
首页 > 其他好文 > 详细

18._3分部类概述及其使用

时间:2016-07-02 22:45:28      阅读:147      评论:0      收藏:0      [点我收藏+]

标签:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _18._3分部类概述及其使用
{

    partial class atithmetic //阶乘
    {
        public int factorial(int num)
            {
            int factorial = 1;
        for(int i =num;i>0;i--)
            factorial*=i;
            return factorial;
            }
    }


    partial class atithmetic //平方
    {
        public int square(int num)
        {
            return num * num;
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            atithmetic a = new atithmetic();
            int num = 5;
            Console.WriteLine("调用分部类的第一部分:{0}",a.factorial(num));
            Console.WriteLine("调用分部类的第二部分:{0}",a.square(num));
            Console.Read();
        }
    }
}

 

18._3分部类概述及其使用

标签:

原文地址:http://www.cnblogs.com/zqyo2000z/p/5636150.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!