search
尋找貓咪~QQ 地點 桃園市桃園區 Taoyuan , Taoyuan

C# 建立/使用 .net DLL(CS_Create_Use_DLL) – jashliao部落格

C# 建立/使用 .net DLL(CS_Create_Use_DLL)


資料來源: https://dotblogs.com.tw/hung-chin/2011/09/30/38449

GITHUB: https://github.com/jash-git/CS_Create_Use_DLL


DLL

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

namespace CS_Create_Use_DLL
{
    public class Class1
    {
        //https://dotblogs.com.tw/hung-chin/2011/09/30/38449
        public string StrUpperLower(string word,bool blnUpper=true)//方法名稱
        {
            if(blnUpper)
            {
                return word.ToUpper();
            }
            else
            {
                return word.ToLower();
            }      
        }
    }
}

EXE

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

using CS_Create_Use_DLL;
namespace testDLL
{
    class Program
    {
        static void Pause()
        {
            Console.Write("Press any key to continue...");
            Console.ReadKey(true);
        }
        static void Main(string[] args)
        {
            Class1 x = new Class1();//用new 建立類別實體
            String StrData = "jash.liao";

            Console.WriteLine("{0} Upper {1}", StrData,x.StrUpperLower(StrData));
            Console.WriteLine("{0} Lower {1}", x.StrUpperLower(StrData), x.StrUpperLower(StrData,false));
            Pause();
        }
    }
}



熱門推薦

本文由 jashliaoeuwordpress 提供 原文連結

寵物協尋 相信 終究能找到回家的路
寫了7763篇文章,獲得2次喜歡
留言回覆
回覆
精彩推薦