-
Collection.Contains(String) 方法
定义
返回一个值,该值指示 Visual Basic Collection
对象是否包含一个带有特定键的元素。
C#
public bool Contains (string Key);
参数
返回
如果 Visual Basic Collection
对象包含一个带有特定键的元素,则为 true
;否则为 false
。
示例
VB
Dim customers As New Microsoft.VisualBasic.Collection()
Dim accountNumber As String = "1234"
' Insert code that obtains new customer objects.
' Use the new customer's account number as the key.
customers.Add(newCustomer, accountNumber)
' The preceding statements can be repeated for several customers.
Dim searchNumber As String = "1234"
' Insert code to obtain an account number to search for.
If customers.Contains(searchNumber) Then
MsgBox("The desired customer is in the collection.")
Else
MsgBox("The desired customer is not in the collection.")
End If
如果要使用其键搜索集合中的元素,请记住在每次调用Add
该方法时提供Key
参数。
注解
Contains
如果 True
集合包含键完全匹配 Key
的元素,则返回 。 否则,Contains
将返回 False
。 匹配键值时忽略事例。
Visual BasicCollection
可以保存具有键和其他元素且没有键的元素。 这取决于对方法的调用 Add 是否向可选 Key
参数提供参数。
适用于
产品 | 版本 |
---|---|
.NET | Core 3.0, Core 3.1, 5, 6, 7 Preview 4 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 |
原文链接:https://docs.microsoft.com/zh-cn/dotnet/api/microsoft.visualbasic.collection.contains?view=net-6.0
栏目列表
最新更新
C# 编写一个简单易用的 Windows 截屏增强工
Python 引用其他路径下的module
【Python - 基础】基础是一切升华的根本
自动化办公:手机号码提取器,使用正则
C#/VB.NET 创建图片超链接
1w+ 字总结 Java 常用类,整理太全了,建议
EasyExcel-合并单元格
Spring Boot 3 开发上线一个前后端分离的生
Spring Boot 3 开发上线一个前后端分离的生
Spring Boot 3 开发上线一个前后端分离的生
MongoDB常用命令(2)
MongoDB基本介绍与安装(1)
SQLServer触发器调用JavaWeb接口
SQL Server索引的原理深入解析
SqlServer2016模糊匹配的三种方式及效率问题
SQL中Truncate的用法
sqlserver 多表关联时在where语句中慎用tri
链接服务器读取Mysql---出现消息 7347,级别
SQL Server解惑——为什么你拼接的SQL语句换
MySQL视图了解一下
laf.js - 开源的云开发框架(README.md)
javascript创建对象
Node.js 源码分析 - 从 main 函数开始
Node.js 源码分析 - 原生模块(C++模块)的注册
ECharts图标中用的js相关的处理方法
GoJS 使用笔记
单元测试 - 测试场景记录
Node.js 源码分析 - 加载 js 文件
ES6入门
聊聊动效降级