本文整理汇总了C#中System.Reflection.FieldInfo.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# FieldInfo.Equals方法的具体用法?C# FieldInfo.Equals怎么用?C# FieldInfo.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.FieldInfo
的用法示例。
在下文中一共展示了FieldInfo.Equals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IndexOf
/// <summary>
/// Returns the zero-based index of the first occurrence
/// of the specified <see cref="FieldInfo"/> in the
/// <see cref="FieldInfoCollection"/>.
/// </summary>
/// <param name="value">
/// The <see cref="FieldInfo"/> object
/// to locate in the <see cref="FieldInfoCollection"/>.
/// This argument may be a null reference.
/// </param>
/// <returns>
/// The zero-based index of the first occurrence of
/// <paramref name="value"/> in the <see cref="FieldInfoCollection"/>,
/// if found; otherwise, -1.</returns>
/// <remarks>
/// Please refer to <see cref="ArrayList.IndexOf(object)"/> for details.
/// </remarks>
public int IndexOf(FieldInfo value)
{
int count = _data.Count;
FieldInfo[] items = _data.Items;
if (value == null)
{
for (int i = 0; i < count; i++)
{
if (items[i] == null)
return i;
}
return -1;
}
for (int i = 0; i < count; i++)
{
if (value.Equals(items[i]))
return i;
}
return -1;
}