C#面试题

当前位置: 面试问题网 > C#面试题 > extern是什么意思

extern是什么意思

extern 修饰符用于声明由程序集外部实现的成员函数
   经常用于系统API函数的调用(通过 DllImport )。注意,和DllImport一起使用时要加上 static 修饰符
   也可以用于对于同一程序集不同版本组件的调用(用 extern 声明别名)
   不能与 abstract 修饰符同时使用
   示例:
   using System;
   using System.Collections.Generic;
   using System.Text;
   using System.Runtime.InteropServices;
   namespace Example03
   {
   class Program
   {
   //注意DllImport是一个Attribute Property,在System.Runtime.InteropServices命名空间中定义
   //extern与DllImport一起使用时必须再加上一个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);
   }
   }
   }

【extern是什么意思】相关文章

1. extern是什么意思

2. extern在函数声明中是什么意思

3. what is the difference between ext2 and ext3

4. 在C++ 程序中调用被C 编译器编译后的函数,为什么要加extern "C"

5. 介绍一下ICMP(Internet Control Message Protocol)Internet控制信息协议

6. 软件测试LoadRunner面试题:What is the difference between standard log and extended log?

7. Spring中ApplicationContext的作用是什么

8. Java里面Pass by value和Pass by Reference是什么意思

9. 如何反序的迭代一个序列?how do I iterate over a sequence in reverse order

10. 停止劳动合同执行是什么意思?

本文来源:https://www.mianshiwenti.com/a12994.html

点击展开全部

《extern是什么意思》

将本文的Word文档下载到电脑,方便收藏和打印

推荐程度:

进入下载页面

﹝extern是什么意思﹞相关内容

「extern是什么意思」相关专题

其它栏目

也许您还喜欢