当前位置: 首页 > news >正文

c++ 网站开发WordPress文章登录后可看

c++ 网站开发,WordPress文章登录后可看,果合gohe网站建设,wordpress 本文内容 使用 C# 索引器实现 C# 的 is 和 as 关键字实现 C# 的 lock 关键字 本节中的主题介绍如何在 Visual C 中创建程序集#xff0c;这些程序集使用或提供以 C# 或 Visual Basic 编写的程序集的功能。 1、使用 C# 索引器 Visual C 不包含索引器#xff1b;它具有索引…本文内容 使用 C# 索引器实现 C# 的 is 和 as 关键字实现 C# 的 lock 关键字 本节中的主题介绍如何在 Visual C 中创建程序集这些程序集使用或提供以 C# 或 Visual Basic 编写的程序集的功能。 1、使用 C# 索引器 Visual C 不包含索引器它具有索引属性。 若要使用 C# 索引器请访问索引器就像它是索引属性一样。 示例 以下 C# 程序定义索引器。 // consume_cs_indexers.cs // compile with: /target:library using System; public class IndexerClass {private int [] myArray new int[100];public int this [int index] { // Indexer declarationget {// Check the index limits.if (index 0 || index 100)return 0;elsereturn myArray[index];}set {if (!(index 0 || index 100))myArray[index] value;}} } /* // code to consume the indexer public class MainClass {public static void Main() {IndexerClass b new IndexerClass();// Call indexer to initialize elements 3 and 5b[3] 256;b[5] 1024;for (int i 0 ; i 10 ; i)Console.WriteLine(Element #{0} {1}, i, b[i]);} } */此 C/CLI 程序使用索引器。 // consume_cs_indexers_2.cpp // compile with: /clr #using consume_cs_indexers.dll using namespace System;int main() {IndexerClass ^ ic gcnew IndexerClass;ic-default[0] 21;for (int i 0 ; i 10 ; i)Console::WriteLine(Element #{0} {1}, i, ic-default[i]); }此示例产生以下输出 Element #0 21 Element #1 0 Element #2 0 Element #3 0 Element #4 0 Element #5 0 Element #6 0 Element #7 0 Element #8 0 Element #9 0 Element #10 02、实现 C# 的 is 和 as 关键字 本主题演示如何在 Visual C 中实现 C# 的 is 和 as 关键字的功能。 示例 // CS_is_as.cpp // compile with: /clr using namespace System;interface class I { public:void F(); };ref struct C : public I {virtual void F( void ) { } };template class T, class U Boolean isinst(U u) {return dynamic_cast T (u) ! nullptr; }int main() {C ^ c gcnew C();I ^ i safe_cast I ^ (c); // is (maps to castclass in IL)I ^ ii dynamic_cast I ^ (c); // as (maps to isinst in IL)// simulate as:Object ^ o f;if ( isinst String ^ (o) )Console::WriteLine(o is a string); }输出结果 o is a string3、实现 C# 的 lock 关键字 本主题演示如何在 Visual C 中实现 C# lock 关键字。 示例 // CS_lock_in_CPP.cpp // compile with: /clr using namespace System::Threading; ref class Lock {Object^ m_pObject; public:Lock( Object ^ pObject ) : m_pObject( pObject ) {Monitor::Enter( m_pObject );}~Lock() {Monitor::Exit( m_pObject );} };ref struct LockHelper {void DoSomething(); };void LockHelper::DoSomething() {// Note: Reference type with stack allocation semantics to provide// deterministic finalizationLock lock( this );// LockHelper instance is locked }int main() {LockHelper lockHelper;lockHelper.DoSomething();return 0; }
http://www.sczhlp.com/news/237119/

相关文章:

  • 设计网站国外网站全国企业查询系统信息
  • 哪个网站可以做立体字的模板wordpress主题手机端
  • 泉州市住房和乡村建设网站wordpress远程插件
  • 广中路街道网站建设网站建设要求 牛商网
  • 免费行情软件app网站红色WordPress影视资源模板
  • 装修平台网站免费安装电脑wordpress
  • o2o网站建设最好公司排名贤邦网站建设app开发
  • 网站哪家公司做的做网站分辨率多少
  • html+jsp个人网站模板企业网站推广的方法包括
  • 网站开发网上悼念免费建立移动网站吗
  • html 图片展示网站网件路由器app 中文版
  • html5 微网站开发招代理的网站要怎么做
  • 常州哪家网站建设公司专业陕西专业网站开发公司
  • 酒泉网站建设设计单页面淘宝客网站
  • 中天建设第四网站上海装修公司网站建设
  • 企业中英文网站开发wordpress 增删改查
  • 东莞大型企业网站建设成都建设网页公司
  • 温州网站建设最新报价安徽中擎建设公司网站
  • 长沙网站托管seo优化公司wordpress前端验证
  • 做实体识别的网站2018做网站开发一个月工资多少
  • 高端网站建设案例网站开发所需技能
  • 数据分析对网站建设的重要性支付宝手机网站
  • wordpress公益长春seo经理
  • 青海网站制作多少钱呼和浩特公司网页设计
  • 上海建设厅是哪个网站竞价推广账户托管费用
  • 带登录网站模板常州做网站需要多少钱
  • 免费在线观看韩国电视剧网站推荐中国工程建设监理网站
  • 网站改版的形式大致有企业销售网站建设
  • 中企动力做网站贵吗做搜狗网站优化快速排
  • 建设银行网站怎么看不见余额金泉网站建设开发