本文整理汇总了C#中System.Collections.Specialized.StringCollection类的典型用法代码示例。如果您正苦于以下问题:C# StringCollection类的具体用法?C# StringCollection怎么用?C# StringCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringCollection类属于System.Collections.Specialized命名空间,在下文中一共展示了StringCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
/// <summary>
/// Receives the old name and the not valid names list
/// </summary>
/// <param name="displaySetName"></param>
/// <param name="notValidNames"></param>
public void Initialize(string displaySetName, StringCollection notValidNames)
{
mName = displaySetName;
mNotValidNames = notValidNames;
ApplyMultilanguage();
LoadValues();
}
示例2: SplitCamelCase
/// <summary>
/// http://weblogs.asp.net/jgalloway/archive/2005/09/27/426087.aspx
/// </summary>
public static List<string> SplitCamelCase(this string source)
{
if (source == null)
return new List<string> { }; //Return empty array.
if (source.Length == 0)
return new List<string> { "" };
StringCollection words = new StringCollection();
int wordStartIndex = 0;
char[] letters = source.ToCharArray();
// Skip the first letter. we don't care what case it is.
for (int i = 1; i < letters.Length; i++)
{
if (char.IsUpper(letters[i]))
{
//Grab everything before the current index.
words.Add(new String(letters, wordStartIndex, i - wordStartIndex));
wordStartIndex = i;
}
}
//We need to have the last word.
words.Add(new String(letters, wordStartIndex, letters.Length - wordStartIndex));
//Copy to a string array.
string[] wordArray = new string[words.Count];
words.CopyTo(wordArray, 0);
List<string> stringList = new List<string>();
stringList.AddRange(wordArray);
return stringList;
}
示例3: CDEntry
public CDEntry(StringCollection data)
{
if (!Parse(data))
{
throw new Exception("Unable to Parse CDEntry.");
}
}
示例4: CFileFound
public CFileFound(string in_Hash, string in_Name, uint in_Size, uint in_Avaibility, string in_codec,string in_length,uint in_bitrate, bool in_complete, uint in_ip, ushort in_port)
{
this.Hash=in_Hash;
this.Name=in_Name;
this.Size=in_Size;
this.Avaibility=in_Avaibility;
Codec=in_codec;
BitRate=in_bitrate;
Length=in_length;
Complete=in_complete;
this.OtherNames=new StringCollection();
this.OtherNames.Add(Name);
CElement element=CKernel.FilesList[CKernel.StringToHash(in_Hash)];
if (element==null)
ResultState=Types.Constants.SearchResultState.New;
else if (element.File.FileStatus==Protocol.FileState.Complete)
ResultState=Types.Constants.SearchResultState.AlreadyDownloaded;
else
ResultState=Types.Constants.SearchResultState.AlreadyDownloading;
if ((in_ip>Protocol.LowIDLimit)&&(in_port>0)&&(in_port<ushort.MaxValue))
{
Sources=new Hashtable();
Sources.Add(in_ip,in_port);
//Debug.WriteLine(in_ip.ToString()+":"+in_port.ToString());
if ((element!=null)&&(element.File.FileStatus==Protocol.FileState.Ready))
CKernel.ClientsList.AddClientToFile(in_ip,in_port,0,0,element.File.FileHash);
}
}
示例5: PeekrPop2006
///<summary>
///</summary>
public PeekrPop2006()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
// Source Queues
mqServerName.Items.Clear();
queueName.Items.Clear();
// Target Queues
targetServerCombo.Items.Clear();
targetQueueCombo.Items.Clear();
targetQueue2.Items.Clear();
// Source Machine Names
StringCollection sc = new StringCollection ();
sc.Add ("VDC3APP0006");
sc.Add ("localhost");
foreach (string s in sc)
{
mqServerName.Items.Add (s);
targetServerCombo.Items.Add (s);
}
}
示例6: SplitUpperCase
public static string[] SplitUpperCase(this string source)
{
if (source == null)
return new string[] {}; //Return empty array.
if (source.Length == 0)
return new[] {""};
var words = new StringCollection();
int wordStartIndex = 0;
char[] letters = source.ToCharArray();
char previousChar = char.MinValue;
// Skip the first letter. we don't care what case it is.
for (int i = 1; i < letters.Length; i++)
{
if (char.IsUpper(letters[i]) && !char.IsWhiteSpace(previousChar))
{
//Grab everything before the current index.
words.Add(new String(letters, wordStartIndex, i - wordStartIndex));
wordStartIndex = i;
}
previousChar = letters[i];
}
//We need to have the last word.
words.Add(new String(letters, wordStartIndex, letters.Length - wordStartIndex));
//Copy to a string array.
var wordArray = new string[words.Count];
words.CopyTo(wordArray, 0);
return wordArray;
}
示例7: generate
/// <summary>
/// Generate statistics file
/// </summary>
/// <returns></returns>
public StringCollection generate()
{
#region delete all older files (of the same type) for this questionnaire to clean temp-Directory
try
{
foreach (string file in Directory.GetFiles(pathtotempdir, "RFG_report_statistic_*"))
{
File.Delete(file);
}
}
catch (Exception ex)
{
string dummy = ex.ToString();
}
#endregion
int statistics_records = -1;
List<string> files_names = new List<string>();
statistics_records = ReportingFacade.Format(from, until, ordering, row_number, pathtotempdir,Company_Code, ref files_names);
StringCollection retvals = new StringCollection();
retvals.Add(statistics_records.ToString());
foreach (String file in files_names)
retvals.Add(file);
return retvals;
}
示例8: CheckFileNameUsingPaths
private static bool CheckFileNameUsingPaths(string fileName, StringCollection paths, out string fullFileName)
{
fullFileName = null;
string str = fileName.Trim(new char[] { '"' });
FileInfo info = new FileInfo(str);
if (str.Length != info.Name.Length)
{
if (info.Exists)
{
fullFileName = info.FullName;
}
return info.Exists;
}
using (StringEnumerator enumerator = paths.GetEnumerator())
{
while (enumerator.MoveNext())
{
string str3 = enumerator.Current + Path.DirectorySeparatorChar + str;
FileInfo info2 = new FileInfo(str3);
if (info2.Exists)
{
fullFileName = str3;
return true;
}
}
}
return false;
}
示例9: ConvertFrom
/// <summary>
/// Converts the given object to a StringCollection.
/// </summary>
/// <param name="context">An ITypeDescriptorContext that provides a format context.</param>
/// <param name="culture">The CultureInfo to use as the current culture.</param>
/// <param name="value">The object to convert.</param>
/// <returns>A StringCollection converted from value.</returns>
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
string valueAsStr = value as string;
if (valueAsStr != null)
{
string str = valueAsStr.Trim();
if (str.Length == 0)
{
return null;
}
char ch = ',';
if (culture != null)
{
ch = culture.TextInfo.ListSeparator[0];
}
string[] strings = str.Split(ch);
StringCollection stringCollection = new StringCollection();
foreach (string s in strings)
{
stringCollection.Add(s);
}
return stringCollection;
}
return base.ConvertFrom(context, culture, value);
}
示例10: ParseParameters
/// <summary>
/// Parses the parameters portion of the message.
/// </summary>
protected override void ParseParameters( StringCollection parameters )
{
base.ParseParameters( parameters );
this.Users.Clear();
String[] userInfo = parameters[ parameters.Count - 1 ].Split( ' ' );
foreach ( String info in userInfo )
{
String nick = info.Substring( 0, info.IndexOf( "=", StringComparison.Ordinal ) );
Boolean oper = false;
if ( nick.EndsWith( "*", StringComparison.Ordinal ) )
{
oper = true;
nick = nick.Substring( 0, nick.Length - 1 );
}
String away = info.Substring( info.IndexOf( "=", StringComparison.Ordinal ) + 1, 1 );
String standardHost = info.Substring( info.IndexOf( away, StringComparison.Ordinal ) );
User user = new User();
user.Parse( standardHost );
user.Nick = nick;
user.IrcOperator = oper;
user.OnlineStatus = ( away == "+" ) ? UserOnlineStatus.Away : UserOnlineStatus.Online;
this.Users.Add( user );
}
}
示例11: readBrainFile
//read brain file from disc
protected StringCollection readBrainFile()
{
StringCollection sc = new StringCollection();
if(File.Exists(filePath))
{
FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
StreamReader rs = new StreamReader(fs);
string line;
while ((line = rs.ReadLine()) != null)
{
sc.Add(line);
}
rs.Close();
fs.Close();
}
else
{
MessageBox.Show("No mind file found, creating new one");
FileStream cs = File.Create(filePath);
cs.Close();
FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
StreamReader rs = new StreamReader(fs);
string line;
while ((line = rs.ReadLine()) != null)
{
sc.Add(line);
}
rs.Close();
fs.Close();
}
return sc;
}
示例12: GetSectionNames
public static StringCollection GetSectionNames(
String filename)
{
StringCollection sections = new StringCollection();
byte[] buffer = new byte[32768];
int bufLen = 0;
bufLen = GetPrivateProfileSectionNames(buffer,
buffer.GetUpperBound(0), filename);
if (bufLen > 0)
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < bufLen; i++)
{
if (buffer[i] != 0)
{
sb.Append((char)buffer[i]);
}
else
{
if (sb.Length > 0)
{
sections.Add(sb.ToString());
sb = new StringBuilder();
}
}
}
}
return sections;
}
示例13: AddFile
internal static void AddFile(StringCollection files)
{
SelectedItem selectedItem = VSIHelper.DTE2.SelectedItems.Item(1);
ProjectItems projectItems = null;
if (selectedItem.Project != null && selectedItem.ProjectItem == null)
{
projectItems = selectedItem.Project.ProjectItems;
}
if (selectedItem.Project == null && selectedItem.ProjectItem != null)
{
projectItems = selectedItem.ProjectItem.ProjectItems;
}
if (projectItems != null)
{
ProjectItem lastItem = null;
foreach (var file in files)
{
try
{
lastItem = projectItems.AddFromFileCopy(file);
}
catch { }
}
if (lastItem != null)
{
VSIHelper.DTE2.ItemOperations.OpenFile(lastItem.get_FileNames(1), EnvDTE.Constants.vsViewKindPrimary);
}
}
}
示例14: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
// Initialise data table to hold test results
m_results.Columns.Add("test");
m_results.Columns.Add("result");
m_results.Columns.Add("time");
m_results.Columns.Add("message");
m_results.Columns.Add("class");
// Initialise controls
lblResult.Text = "";
ltlStats.Text = "";
// Initialise NUnit
CoreExtensions.Host.InitializeService();
// Find tests in current assembly
TestPackage package = new TestPackage(Assembly.GetExecutingAssembly().Location);
m_testSuite = new TestSuiteBuilder().Build(package);
if (!IsPostBack)
{
// Display category filters
StringCollection coll = new StringCollection();
GetCategories((TestSuite)m_testSuite, coll);
string[] cats = new string[coll.Count];
coll.CopyTo(cats, 0);
Array.Sort(cats);
cblCategories.DataSource = cats;
cblCategories.DataBind();
}
}
示例15: AddinRegistry
internal AddinRegistry (string registryPath, string startupDirectory)
{
basePath = Util.GetFullPath (registryPath);
database = new AddinDatabase (this);
addinDirs = new StringCollection ();
addinDirs.Add (Path.Combine (basePath, "addins"));
}