十年網(wǎng)站開發(fā)經(jīng)驗 + 多家企業(yè)客戶 + 靠譜的建站團隊
量身定制 + 運營維護+專業(yè)推廣+無憂售后,網(wǎng)站問題一站解決
小編給大家分享一下如何使用CSC.exe將module組合成assembly,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

代碼如下:
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;
}
}
}csc.exe /t:module FrequentlyUsedCalculator.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;
}
}
}csc.exe /t:module RarelyUsedCalculator.cs

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

using System;
using MyClassLib;
namespace MyConsoleApp
{
class Program
{
static void Main(string[] args)
{
Console.Write("請輸入第一個整數(shù):");
int number1 = Convert.ToInt32(Console.ReadLine());
Console.Write("請輸入第二個整數(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();
}
}
}csc.exe /out:Program.exe /t:exe /r:MyClassLib.dll Program.cs


以上是“如何使用CSC.exe將module組合成assembly”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學習更多知識,歡迎關(guān)注創(chuàng)新互聯(lián)網(wǎng)站制作公司行業(yè)資訊頻道!
創(chuàng)新互聯(lián)www.cdcxhl.cn,專業(yè)提供香港、美國云服務器,動態(tài)BGP最優(yōu)骨干路由自動選擇,持續(xù)穩(wěn)定高效的網(wǎng)絡助力業(yè)務部署。公司持有工信部辦法的idc、isp許可證, 機房獨有T級流量清洗系統(tǒng)配攻擊溯源,準確進行流量調(diào)度,確保服務器高可用性。佳節(jié)活動現(xiàn)已開啟,新人活動云服務器買多久送多久。