网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

如何使用CSC.exe将module组合成assembly-创新互联

小编给大家分享一下如何使用CSC.exe将module组合成assembly,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

成都创新互联从2013年创立,是专业互联网技术服务公司,拥有项目网站建设、网站制作网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元湘乡做网站,已为上家服务,为湘乡各地企业和个人服务,联系电话:028-86922220

1、新建一个FrequentlyUsedCalculator.cs文件

代码如下:

using System;

namespace MyClassLib
{
    public class FrequentlyUsedCalculator
    {
        public int Add(int a, int b)
        {
            return a + b;
        }

        public int Sub(int a, int b)
        {
            return a - b;
        }
    }
}

2、对FrequentlyUsedCalculator.cs文件进行编译

csc.exe /t:module FrequentlyUsedCalculator.cs

3、新建一个RarelyUsedCalculator.cs文件

代码如下:

using System;

namespace MyClassLib
{
    public class RarelyUsedCalculator
    {
        public int Multiple(int a,int b)
        {
            return a * b;
        }

        public int Divide(int a, int b)
        {
            return a / b;
        }
    }
}

4、对RarelyUsedCalculator.cs文件进行编译

csc.exe /t:module RarelyUsedCalculator.cs

如何使用CSC.exe将module组合成assembly

5、将module文件合并成assembly文件

al.exe /out:MyClassLib.dll /t:library FrequentlyUsedCalculator.netmodule RarelyUsedCalculator.netmodule

如何使用CSC.exe将module组合成assembly

6、新建一个Program.cs文件

using System;
using MyClassLib;

namespace MyConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("请输入第一个整数:");
            int number1 = Convert.ToInt32(Console.ReadLine());
            Console.Write("请输入第二个整数:");
            int number2 = Convert.ToInt32(Console.ReadLine());
            FrequentlyUsedCalculator cal1 = new FrequentlyUsedCalculator();
            Console.WriteLine("{0} + {1} = {2}", number1, number2, cal1.Add(number1, number2));
            Console.WriteLine("{0} - {1} = {2}", number1, number2, cal1.Sub(number1, number2));
            RarelyUsedCalculator cal2 = new RarelyUsedCalculator();
            Console.WriteLine("{0} * {1} = {2}", number1, number2, cal2.Multiple(number1, number2));
            Console.WriteLine("{0} / {1} = {2}", number1, number2, cal2.Divide(number1, number2));
            Console.ReadKey();
        }
    }
}

7、对Program.cs进行编译

csc.exe /out:Program.exe /t:exe /r:MyClassLib.dll Program.cs

如何使用CSC.exe将module组合成assembly

8、运行结果

如何使用CSC.exe将module组合成assembly

以上是“如何使用CSC.exe将module组合成assembly”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联网站制作公司行业资讯频道!

创新互联www.cdcxhl.cn,专业提供香港、美国云服务器,动态BGP最优骨干路由自动选择,持续稳定高效的网络助力业务部署。公司持有工信部办法的idc、isp许可证, 机房独有T级流量清洗系统配攻击溯源,准确进行流量调度,确保服务器高可用性。佳节活动现已开启,新人活动云服务器买多久送多久。


名称栏目:如何使用CSC.exe将module组合成assembly-创新互联
本文链接:http://bjjierui.cn/article/hcjhg.html

其他资讯