我有以下代码片段:
public static List<string> sqlData = new List<string>();
//
// lots of code here
//
if (/* check here to see if the sqlData[whatever] index exists */)
{
sqlData.Insert(count2, sqlformatted);
}
else
{
sqlData.Insert(count2, sqlformatted + sqlData[count2]);
}
Run Code Online (Sandbox Code Playgroud)
我想知道的是如何在尝试插入包含自身的东西之前检查sqlData上的索引以查看它是否存在.