如何使用CSC.exe將module組合成assembly-創(chuàng)新互聯(lián)

小編給大家分享一下如何使用CSC.exe將module組合成assembly,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

成都創(chuàng)新互聯(lián)從2013年創(chuàng)立,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目網(wǎng)站建設(shè)、網(wǎng)站制作網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢(mèng)想脫穎而出為使命,1280元湘鄉(xiāng)做網(wǎng)站,已為上家服務(wù),為湘鄉(xiāng)各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:028-86922220

1、新建一個(gè)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、對(duì)FrequentlyUsedCalculator.cs文件進(jìn)行編譯

csc.exe /t:module FrequentlyUsedCalculator.cs

3、新建一個(gè)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、對(duì)RarelyUsedCalculator.cs文件進(jìn)行編譯

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、新建一個(gè)Program.cs文件

using System;
using MyClassLib;

namespace MyConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("請(qǐng)輸入第一個(gè)整數(shù):");
            int number1 = Convert.ToInt32(Console.ReadLine());
            Console.Write("請(qǐng)輸入第二個(gè)整數(shù):");
            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、對(duì)Program.cs進(jìn)行編譯

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

如何使用CSC.exe將module組合成assembly

8、運(yùn)行結(jié)果

如何使用CSC.exe將module組合成assembly

以上是“如何使用CSC.exe將module組合成assembly”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)網(wǎng)站制作公司行業(yè)資訊頻道!

創(chuàng)新互聯(lián)www.cdcxhl.cn,專業(yè)提供香港、美國(guó)云服務(wù)器,動(dòng)態(tài)BGP最優(yōu)骨干路由自動(dòng)選擇,持續(xù)穩(wěn)定高效的網(wǎng)絡(luò)助力業(yè)務(wù)部署。公司持有工信部辦法的idc、isp許可證, 機(jī)房獨(dú)有T級(jí)流量清洗系統(tǒng)配攻擊溯源,準(zhǔn)確進(jìn)行流量調(diào)度,確保服務(wù)器高可用性。佳節(jié)活動(dòng)現(xiàn)已開(kāi)啟,新人活動(dòng)云服務(wù)器買多久送多久。

網(wǎng)站欄目:如何使用CSC.exe將module組合成assembly-創(chuàng)新互聯(lián)
轉(zhuǎn)載來(lái)源:http://muchs.cn/article46/hcjhg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站改版網(wǎng)站制作、定制網(wǎng)站、網(wǎng)站內(nèi)鏈、App開(kāi)發(fā)、全網(wǎng)營(yíng)銷推廣

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

h5響應(yīng)式網(wǎng)站建設(shè)