在C#中用括号混淆了? [英] Confused with brackets in C#?

查看:93
本文介绍了在C#中用括号混淆了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Guid guid = Guid.Parse(读者[邀请] .ToString());



请告诉我这是什么功能?我的意思是括号[]发生了什么?我在ado.net到处都看到这样的括号?它是索引器吗?我猜邀请是sql server数据库中的列?

Guid guid = Guid.Parse(reader["invite"].ToString());

please tell me what feature is this ? I mean the the bracket [""] what's happening ? I see such brackets everywhere in ado.net? is it indexer ? I guess "invite" is column in sql server database ?

推荐答案

方括号([])用于数组,索引器和属性。它们也可以与指针一起使用。

参考: []运算符(C#参考) [ ^ ]

Square brackets ([]) are used for arrays, indexers, and attributes. They can also be used with pointers.
Reference :[] Operator (C# Reference)[^]
引用:

是索引器吗?我猜邀请是sql server数据库中的列?

is it indexer ? I guess "invite" is column in sql server database ?

是的,它是字符串索引器,其中字符串是列名

Yes, it is string indexer, where the string is the column name


这篇关于在C#中用括号混淆了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆