亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

C#學(xué)習(xí)基礎(chǔ)概念二十五問第2/4頁(yè)

 更新時(shí)間:2007年04月09日 00:00:00   作者:  

3.extern 是什么意思?
答:
extern 修飾符用于聲明由程序集外部實(shí)現(xiàn)的成員函數(shù)
經(jīng)常用于系統(tǒng)API函數(shù)的調(diào)用(通過 DllImport )。注意,和DllImport一起使用時(shí)要加上 static 修飾符
也可以用于對(duì)于同一程序集不同版本組件的調(diào)用(用 extern 聲明別名)
不能與 abstract 修飾符同時(shí)使用
示例:
復(fù)制代碼 代碼如下:

using System; 
using System.Collections.Generic; 
using System.Text; 
using System.Runtime.InteropServices; 
namespace Example03 

    class Program 
    { 
        //注意DllImport是一個(gè)Attribute Property,在System.Runtime.InteropServices命名空間中定義 
        //extern與DllImport一起使用時(shí)必須再加上一個(gè)static修飾符 
        [DllImport("User32.dll")] 
        public static extern int MessageBox(int Handle, string Message, string Caption, int Type); 
        static int Main() 
        { 
            string myString; 
            Console.Write("Enter your message: "); 
            myString = Console.ReadLine(); 
            return MessageBox(0, myString, "My Message Box", 0); 
        } 
    } 


相關(guān)文章

最新評(píng)論