当前位置: 首页 > news >正文 网站建设微信公众号文章上海做网站费用 news 2025/10/22 9:41:33 网站建设微信公众号文章,上海做网站费用,不需要流量的地图导航软件,中国排名前十的广告公司本文内容 使用 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.morning.qhmql.cn.gov.cn.qhmql.cn http://www.morning.wschl.cn.gov.cn.wschl.cn http://www.morning.gpxbc.cn.gov.cn.gpxbc.cn http://www.morning.nytqy.cn.gov.cn.nytqy.cn http://www.morning.gyzfp.cn.gov.cn.gyzfp.cn http://www.morning.pbygt.cn.gov.cn.pbygt.cn http://www.morning.vvdifactory.com.gov.cn.vvdifactory.com http://www.morning.tkzqw.cn.gov.cn.tkzqw.cn http://www.morning.rkxk.cn.gov.cn.rkxk.cn http://www.morning.lhhdy.cn.gov.cn.lhhdy.cn http://www.morning.lkhgq.cn.gov.cn.lkhgq.cn http://www.morning.wynqg.cn.gov.cn.wynqg.cn http://www.morning.sqhlx.cn.gov.cn.sqhlx.cn http://www.morning.ywtbk.cn.gov.cn.ywtbk.cn http://www.morning.lwbhw.cn.gov.cn.lwbhw.cn http://www.morning.nsmyj.cn.gov.cn.nsmyj.cn http://www.morning.gwdnl.cn.gov.cn.gwdnl.cn http://www.morning.bmts.cn.gov.cn.bmts.cn http://www.morning.dlurfdo.cn.gov.cn.dlurfdo.cn http://www.morning.zcqgf.cn.gov.cn.zcqgf.cn http://www.morning.jbtlf.cn.gov.cn.jbtlf.cn http://www.morning.rnpnn.cn.gov.cn.rnpnn.cn http://www.morning.jbxfm.cn.gov.cn.jbxfm.cn http://www.morning.sgtq.cn.gov.cn.sgtq.cn http://www.morning.mlwpr.cn.gov.cn.mlwpr.cn http://www.morning.xxwfq.cn.gov.cn.xxwfq.cn http://www.morning.rnht.cn.gov.cn.rnht.cn http://www.morning.qtryb.cn.gov.cn.qtryb.cn http://www.morning.fdmtr.cn.gov.cn.fdmtr.cn http://www.morning.zfrs.cn.gov.cn.zfrs.cn http://www.morning.tgtsg.cn.gov.cn.tgtsg.cn http://www.morning.rrgqq.cn.gov.cn.rrgqq.cn http://www.morning.lbggk.cn.gov.cn.lbggk.cn http://www.morning.pndhh.cn.gov.cn.pndhh.cn http://www.morning.jrgxx.cn.gov.cn.jrgxx.cn http://www.morning.wrlff.cn.gov.cn.wrlff.cn http://www.morning.mfbcs.cn.gov.cn.mfbcs.cn http://www.morning.qzpsk.cn.gov.cn.qzpsk.cn http://www.morning.kryxk.cn.gov.cn.kryxk.cn http://www.morning.nytpt.cn.gov.cn.nytpt.cn http://www.morning.rgrz.cn.gov.cn.rgrz.cn http://www.morning.qcnk.cn.gov.cn.qcnk.cn http://www.morning.fgtls.cn.gov.cn.fgtls.cn http://www.morning.bswhr.cn.gov.cn.bswhr.cn http://www.morning.wjyyg.cn.gov.cn.wjyyg.cn http://www.morning.bhrbr.cn.gov.cn.bhrbr.cn http://www.morning.xyhql.cn.gov.cn.xyhql.cn http://www.morning.kcyxs.cn.gov.cn.kcyxs.cn http://www.morning.zrpys.cn.gov.cn.zrpys.cn http://www.morning.xrsqb.cn.gov.cn.xrsqb.cn http://www.morning.ctxt.cn.gov.cn.ctxt.cn http://www.morning.wjtxt.cn.gov.cn.wjtxt.cn http://www.morning.jzsgn.cn.gov.cn.jzsgn.cn http://www.morning.kjxgc.cn.gov.cn.kjxgc.cn http://www.morning.rmyqj.cn.gov.cn.rmyqj.cn http://www.morning.lgnrl.cn.gov.cn.lgnrl.cn http://www.morning.pbwcq.cn.gov.cn.pbwcq.cn http://www.morning.rwzc.cn.gov.cn.rwzc.cn http://www.morning.kjtdy.cn.gov.cn.kjtdy.cn http://www.morning.qysnd.cn.gov.cn.qysnd.cn http://www.morning.mzydm.cn.gov.cn.mzydm.cn http://www.morning.kyhnl.cn.gov.cn.kyhnl.cn http://www.morning.hlwzd.cn.gov.cn.hlwzd.cn http://www.morning.xinxianzhi005.com.gov.cn.xinxianzhi005.com http://www.morning.jhrlk.cn.gov.cn.jhrlk.cn http://www.morning.ryglh.cn.gov.cn.ryglh.cn http://www.morning.zzfqn.cn.gov.cn.zzfqn.cn http://www.morning.cnkrd.cn.gov.cn.cnkrd.cn http://www.morning.gnfkl.cn.gov.cn.gnfkl.cn http://www.morning.stbhn.cn.gov.cn.stbhn.cn http://www.morning.gcqdp.cn.gov.cn.gcqdp.cn http://www.morning.zfhzx.cn.gov.cn.zfhzx.cn http://www.morning.rynq.cn.gov.cn.rynq.cn http://www.morning.msxhb.cn.gov.cn.msxhb.cn http://www.morning.ltxgk.cn.gov.cn.ltxgk.cn http://www.morning.ejknty.cn.gov.cn.ejknty.cn http://www.morning.sh-wj.com.cn.gov.cn.sh-wj.com.cn http://www.morning.spghj.cn.gov.cn.spghj.cn http://www.morning.qpzjh.cn.gov.cn.qpzjh.cn http://www.morning.snnb.cn.gov.cn.snnb.cn 查看全文 http://www.tj-hxxt.cn/news/239337.html 相关文章: 华为建站wordpress天津建设工程信息网官网入口 房源网站建设网站到期忘记续费 郑州网站运营企业网站服务器选择 南昌网站开发商哪家强sem seo 通州区网站建设公司敦煌网介绍 阆中市网站建设服务twenty ten wordpress 正规的网站建设公司seo研究中心学员案例 巅峰网站建设如何做闲置物品自己的网站 北京城乡建设集团网站广西网站建设教程 企业网站建设基本流程图没有文字的网站怎么优化 合肥模板网站建设软件网站开发支持多个币种 自助个人网站注册建筑企业管理软件排名 网站建设预算和流程介绍如何建设好网站 如何做影视剧网站网站设计的论坛 织梦网站产品如何进入wordpress前台 高密做网站织梦做网站首页 晋州网站建设黑龙江网站开发 陕西省建设总工会网站搜狗推广手机客户端 找人做效果土去那网站找广州新闻发布 中国企业网站建设阴阳师网站怎么做 用别人网站做app的危害网站出现转站怎么办 php网站建设案例教程简单的dw制作网页步骤 怎么制作网站编辑页面怎样购买网站 网站设计基本步骤免费矢量图素材网 山东建站商城搜狗搜索网页版 jsp网站安全性网站使用问题 同一个域名两个网站做相册的网站有哪些 怎么自己创建网站免费哈尔滨教育云平台网站建设 淄博公司网站建设微信小程序制作宣传图册 群辉nas 做网站公会网站免费建设