【问题标题】:How is Array.IndexOf implemented in c#?Array.IndexOf 在 C# 中是如何实现的?
【发布时间】:2020-01-19 18:52:36
【问题描述】:

我已经找过了,但似乎在任何地方都找不到。有谁能够帮助我?我需要使用它,但它在我的 Mac 的 Visual Studio 中不存在,所以它会很有帮助。

【问题讨论】:

标签: c# implementation


【解决方案1】:

你是这个意思吗?

string [] aBunchOfWords = new string[] {
            "hey", "check", "out", "this", "bunch", "of", "words"
        }; 
        int whereMyWordIs = Array.IndexOf(aBunchOfWords, "this"); 
        Console.WriteLine(whereMyWordIs);

【讨论】:

  • 只是想知道:为什么人们不赞成这个答案? OP 询问 IndexOf 在 C# 中的位置,他指出它是 Array.IndexOf,代码 sn-p 有效。
  • 问题是“Array.IndexOf在c#中是如何实现的?”这回答了“如何使用 Array.IndexOf”。完全缺乏解释和回答完全不同的问题似乎是它被否决的一个很好的可能原因。
  • @AlexeiLevenkov 这是有道理的。最初的问题措辞不佳,让我感到困惑,所以我不确定 TBH 之后的 OP 是什么。 “我需要使用它,但它在我的 Mac 的 Visual Studio 中不存在,所以它会非常有帮助”使用 @ 987654325@ 但不知道如何。我不知道。无论如何,谢谢。
猜你喜欢
  • 2011-07-18
  • 2013-02-12
  • 2018-10-31
  • 2011-03-05
  • 2018-08-24
  • 1970-01-01
  • 2011-04-07
  • 2020-08-17
  • 1970-01-01
相关资源
最近更新 更多