本文整理汇总了C#中StringCollection.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# StringCollection.ToString方法的具体用法?C# StringCollection.ToString怎么用?C# StringCollection.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringCollection
的用法示例。
在下文中一共展示了StringCollection.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadProperties
private void LoadProperties(ViewSchema view, StringCollection uniqueColumns, StringCollection filterColumns)
{
foreach (ViewColumnSchema col in view.Columns)
{
//need case insensitive
//bool isUniqueMember = uniqueColumns.Contains(col.Name);
bool isUniqueMember = uniqueColumns.ToString().ToLower().IndexOf(col.Name.ToLower()) >= 0;
bool isFilterMember = filterColumns.ToString().ToLower().IndexOf(col.Name.ToLower()) >= 0;
PropertyInfo prop = new PropertyInfo(col, this, isUniqueMember, isFilterMember);
_properties.Add(prop);
if (prop.IsPrimaryKey)
_uniqueProperties.Add(prop);
if (prop.IsFilterKey)
_filterProperties.Add(prop);
}
}
示例2: runTest
public virtual bool runTest()
{
Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver: " + s_strDtTmVer);
int iCountErrors = 0;
int iCountTestcases = 0;
String strLoc = "Loc_000oo";
StringCollection sc;
try
{
Console.WriteLine("--- default ctor ---");
strLoc = "Loc_001oo";
iCountTestcases++;
sc = new StringCollection();
Console.WriteLine("1. compare to null");
iCountTestcases++;
if (sc == null)
{
iCountErrors++;
Console.WriteLine("Err_0001, collection is null after default ctor");
}
Console.WriteLine("2. check Count");
iCountTestcases++;
if (sc.Count != 0)
{
iCountErrors++;
Console.WriteLine("Err_0002, Count = {0} after default ctor", sc.Count);
}
Console.WriteLine("3. check Contains()");
iCountTestcases++;
if (sc.Contains("string"))
{
iCountErrors++;
Console.WriteLine("Err_0003, Contains() returned true after default ctor");
}
Console.WriteLine("4. check ToString()");
iCountTestcases++;
string temp = sc.ToString();
Console.WriteLine(" ToString(): " + temp);
if (temp.IndexOf("StringCollection") == -1)
{
iCountErrors++;
Console.WriteLine("Err_0004, ToString() doesn't contain \"StringCollection\"");
}
Console.WriteLine("5. check returned Type");
iCountTestcases++;
temp = sc.GetType().ToString().Trim();
Console.WriteLine(" GetType(): " + temp);
if (temp.IndexOf("StringCollection") == -1)
{
iCountErrors++;
Console.WriteLine("Err_0005: returned type doesn't contain \"StringCollection\"");
}
Console.WriteLine("6. compare returned Type of two collection");
iCountTestcases++;
string temp1 = (new StringCollection()).GetType().ToString().Trim();
if (String.Compare(temp, temp1) != 0)
{
iCountErrors++;
Console.WriteLine("Err_0006: returned types of two collections differ");
}
Console.WriteLine("7. check IsReadOnly");
iCountTestcases++;
Console.WriteLine(" IsReadOnly: " + sc.IsReadOnly);
if (sc.IsReadOnly)
{
iCountErrors++;
Console.WriteLine("Err_0007: IsReadOnly returned {0}", sc.IsReadOnly);
}
Console.WriteLine("8. check IsSynchronized");
iCountTestcases++;
Console.WriteLine(" IsSynchronized: " + sc.IsSynchronized);
if (sc.IsSynchronized)
{
iCountErrors++;
Console.WriteLine("Err_0008: IsSynchronized returned {0}", sc.IsSynchronized);
}
}
catch (Exception exc_general )
{
++iCountErrors;
Console.WriteLine (s_strTFAbbrev + " : Error Err_general! strLoc=="+ strLoc +", exc_general==\n"+exc_general.ToString());
}
if ( iCountErrors == 0 )
{
Console.WriteLine( "Pass. "+s_strTFPath +" "+s_strTFName+" ,iCountTestcases=="+iCountTestcases);
return true;
}
else
{
Console.WriteLine("Fail! "+s_strTFPath+" "+s_strTFName+" ,iCountErrors=="+iCountErrors+" , BugNums?: "+s_strActiveBugNums );
return false;
}
}