本文整理汇总了C#中System.Collections.Specialized.StringCollection类的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.Specialized.StringCollection类的具体用法?C# System.Collections.Specialized.StringCollection怎么用?C# System.Collections.Specialized.StringCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System.Collections.Specialized.StringCollection类属于命名空间,在下文中一共展示了System.Collections.Specialized.StringCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnAddListValidation_Click
protected void btnAddListValidation_Click(object sender, EventArgs e)
{
// ExStart:AddListValidation
// Accessing the cells collection of the worksheet that is currently active
GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex];
// Access "B1" cell and add some text
GridCell cell = sheet.Cells[0, 1];
cell.PutValue("Select Course:");
// Accessing "C1" cell
cell = sheet.Cells[0, 2];
// Creating List validation for the "C1" cell
var validation = cell.CreateValidation(GridValidationType.List, true);
// Adding values to List validation
var values = new System.Collections.Specialized.StringCollection();
values.Add("Fortran");
values.Add("Pascal");
values.Add("C++");
values.Add("Visual Basic");
values.Add("Java");
values.Add("C#");
validation.ValueList = values;
// ExEnd:AddListValidation
}
示例2: TestDirProcMain
public TestDirProcMain()
{
InitializeComponent();
_EventLog = new Logging();
_EventLog.logFileName = "EventLog";
_EventLog.WriteToLog("EventLog has been created.");
_validExtList = Properties.Settings.Default.ValidFileExt.Split(',').ToList<string>();
System.Collections.Specialized.StringCollection sc = new System.Collections.Specialized.StringCollection();
sc = Properties.Settings.Default.ScanDirectories;
if (sc.Count > 0)
{
_scanDirs = new string[sc.Count];
sc.CopyTo(_scanDirs, 0);
}
else
{
_scanDirs = new string[1];
_scanDirs[0] = Properties.Settings.Default.ScanDirectory;
}
tbRootDir.Text = initTestDirectory(_scanDirs[0], "Scan");
tbOuputDir.Text = initTestDirectory(Properties.Settings.Default.OutputDirectory,"Output");
tbFailedDir.Text = initTestDirectory(Properties.Settings.Default.FailedDirectory,"Failed");;
tbProcessedDir.Text = initTestDirectory(Properties.Settings.Default.ProcessedDirectory, "Processed"); ;
tbFileName.Text = Properties.Settings.Default.TestFileName;
}
示例3: ImageCollection
public ImageCollection(bool isLarge)
{
m_images = new ImageList();
if(isLarge)
m_images.ImageSize = new System.Drawing.Size(32,32);
m_labels = new System.Collections.Specialized.StringCollection();
}
示例4: Extract
public System.Collections.Specialized.StringCollection Extract()
{
String strPattern = "([A-Za-z0-9](([_\\.\\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\\.\\-]?[a-zA-Z0-9]+)*)\\.([A-Za-z]{2,}))";
System.Collections.Specialized.StringCollection collAddresses = new System.Collections.Specialized.StringCollection();
NodeFilter filter = new RegexFilter(strPattern, true);
NodeList nodes = m_obParser.Parse(filter);
if (null != nodes &&
0 != nodes.Size())
{
RegexOptions options = RegexOptions.IgnoreCase | RegexOptions.Multiline;
Regex obRegex = new Regex(strPattern, options);
for(Int32 i = 0; i < nodes.Size(); i++)
{
INode obNode = nodes.ElementAt(i);
String strText = obNode.GetText();
Match m = obRegex.Match(strText);
while(m.Success)
{
collAddresses.Add(m.Groups[0].Value);
// Advance to the next match.
m = m.NextMatch();
}
}
}
return collAddresses;
}
示例5: Main
static void Main(string[] args)
{
var t11 = new System.Object(); //полное имя класса состоит из пространства имен и имени класса
var t12 = new Object(); //можно использовать только имя класс, т.к. пространство имен System объявлено в using
var t21 = new System.Text.StringBuilder();//полное имя класса состоит из пространства имен и имени класса
var t22 = new StringBuilder(); //можно использовать только имя класс, т.к. пространство имен System объявлено в using
var t31 = new System.Collections.Specialized.StringCollection();//полное имя класса состоит из пространства имен и имени класса
//var t32 = new StringCollection(); //нельзя обратиться к классу по краткому имени, т.к. компилятор не сможет его найти в подключенных простанствах имен
//создаем кота
Cat firstCat = new Cat("Catterpiller", DateTime.Now);
firstCat.FavouriteToy = new Toy { Name = "Toy1", Color="Red" };
Cat secondCat = firstCat;//две переменне указывают на обного и того же кота.
//метод Clone создает нового кота с теми же параметрами.
object clonedObj = firstCat.Clone();
//метод Clone возвращает объект типа Object - самого базового типа всех классов в .NET
//чтобы поместить объект в переменную типа Cat, нужно выполнить приведение типа
//в переменной clonedObj лежит объект типа Cat (резулитат метода Clone), поэтому ошибки нет.
Cat thirdCat = (Cat)clonedObj;
//если попытаться привести объект (в котором кошка) к типу Dog, то во время выполнения упадет исключение
//Dog dog = (Dog)clonedObj;
//если изменяем поле в secondCat, то оно меняется и в firstCat (т.к. это один и тот же объект),
//но неменяется в thirdCat, т.к. это уже другой объект
secondCat.FavouriteToy = new Toy() { Name = "Toy2" };
Console.ReadLine();
}
示例6: CreateLimitationForm
public CreateLimitationForm(string strXPathRoot, string strName, XPathNodeIterator xpIterator, bool bAttribute,
System.Collections.Specialized.StringCollection astrPreviousConstraints)
{
InitializeComponent();
m_astrPreviousConstraints = astrPreviousConstraints;
this.textBoxXPath.Text = strXPathRoot;
this.textBoxName.Text = strName;
while ((xpIterator != null) && xpIterator.MoveNext())
{
string strValue = xpIterator.Current.Value;
if (!m_strIteratorValues.Contains(strValue))
m_strIteratorValues.Add(strValue);
}
if (bAttribute)
radioButtonSpecificValue.Checked = true;
else
radioButtonPresenceOnly.Checked = true;
// only enabled on subsequent executions
radioButtonPreviousConstraint.Enabled = (m_astrPreviousConstraints.Count > 0);
helpProvider.SetHelpString(checkedListBox, Properties.Resources.checkedListBoxHelp);
helpProvider.SetHelpString(flowLayoutPanelConstraintType, Properties.Resources.flowLayoutPanelConstraintTypeHelp);
}
示例7: Result
internal Result(System.Collections.IDictionary items)
: base(items)
{
AdapterTypeMap = new System.Collections.Generic.Dictionary<Type, Type>();
Track = new System.Collections.Specialized.StringCollection();
MarkupTextWriter = typeof (System.Web.UI.HtmlTextWriter);
}
示例8: LoadDatabase
private static void LoadDatabase()
{
//Connect to the server
var connectionString = "Data Source=localhost\\sqlexpress;Initial Catalog=master;Integrated Security=SSPI";
var con = new SqlConnection(connectionString);
ServerConnection serverConnection = new ServerConnection(con);
Server sqlServer = new Server(serverConnection);
System.IO.FileInfo mdf = new System.IO.FileInfo(@"Buzzle.mdf");
System.IO.FileInfo ldf = new System.IO.FileInfo(@"Buzzle_log.LDF");
var dbPath = sqlServer.MasterDBPath;
var databasePath = dbPath + @"\Buzzle.mdf";
var databaseLogPath = dbPath + @"\Buzzle_log.LDF";
File.Copy(mdf.FullName, databasePath, true);
File.Copy(ldf.FullName, databaseLogPath, true);
var databasename = mdf.Name.ToLower().Replace(@".mdf", @"");
System.Collections.Specialized.StringCollection databasefiles = new System.Collections.Specialized.StringCollection();
databasefiles.Add(databasePath);
databasefiles.Add(databaseLogPath);
sqlServer.AttachDatabase(databasename, databasefiles);
}
示例9: Core
public Core(UI.EventManager pEventManager)
{
EventManager = pEventManager;
NameQueryResponseInfoList = new Dictionary<WoWGuid, NameQueryResponseInfo>();
ChatList = new System.Collections.Specialized.StringCollection();
ObjList = new Dictionary<WoWGuid, ObjectBase>();
}
示例10: HsOutput
public HsOutput(System.Type ty,System.Reflection.MemberInfo[] mems)
{
m_type = ty;
m_members = mems;
m_names = new System.Collections.Specialized.StringCollection();
m_imports = new System.Collections.Specialized.StringCollection();
m_modname = "Dotnet." + m_type.FullName;
}
示例11: EnsureExistence
private void EnsureExistence()
{
if (Keys == null || Values == null)
{
Keys = new System.Collections.Specialized.StringCollection();
Values = new System.Collections.Specialized.StringCollection();
}
}
示例12: CopyAsFile
private void CopyAsFile(System.Drawing.Imaging.ImageFormat format,
String FileExtension)
{
String temp = saveAsTempFile(format, FileExtension);
System.Collections.Specialized.StringCollection files = new
System.Collections.Specialized.StringCollection();
files.Add(temp);
Clipboard.SetFileDropList(files);
}
示例13: ServiceMain
public ServiceMain()
{
InitializeComponent();
_logFile = new Logging();
_logFile.logFileName = "EventLog";
_logFile.WriteToLog("EventLog has been created.");
string minuteDisplay;
int timerIntervalMinutes = Properties.Settings.Default.TimerIntervalMinutes;
minuteDisplay = timerIntervalMinutes == 1 ? " minute." : " minutes.";
_timerIntervalMilliseconds = 1000 * 60 * timerIntervalMinutes;
_logFile.WriteToLog("Timer interval set to " + timerIntervalMinutes.ToString() + minuteDisplay);
System.Collections.Specialized.StringCollection sc = new System.Collections.Specialized.StringCollection();
sc = Properties.Settings.Default.ScanDirectories;
string[] scanDir = new string[sc.Count];
//Copies all rows from string collection
sc.CopyTo(scanDir, 0);
string dirDisplay;
dirDisplay = sc.Count == 1 ? "directory" : "directories";
_logFile.WriteToLog("The following source " + dirDisplay + " will be scanned:");
foreach (string dirName in scanDir)
{
_logFile.WriteToLog("--> " + dirName);
}
//jvc
string failedDir = Properties.Settings.Default.FailedDirectory;
_logFile.WriteToLog("FailedDirectory=" + failedDir);
string outputDir = Properties.Settings.Default.OutputDirectory;
string processedDir = Properties.Settings.Default.ProcessedDirectory;
string validFileExt = Properties.Settings.Default.ValidFileExt;
bool isDebugLogEnabled = Properties.Settings.Default.DebugLogEnabled;
//_logFile.WriteToLog("OutputDirectory=" + outputDir);
_logFile.WriteToLog("ProcessedDirectory=" + processedDir);
_logFile.WriteToLog("ValidFileExt=" + validFileExt);
_logFile.WriteToLog("DebugLogEnabled=" + isDebugLogEnabled);
_logFile.WriteToLog("Creating DirectoryPoller...");
_dirProcessor = new DirectoryProcessor(scanDir, validFileExt, outputDir, processedDir, failedDir, _logFile);
_dirProcessor._isDebugLogEnabled = isDebugLogEnabled;
_dirProcessor._EventLog = _logFile;
_logFile.WriteToLog("DirectoryPoller was successfully created.");
this.timerMain.Interval = _timerIntervalMilliseconds;
//this.timerMain.Elapsed += new System.Timers.ElapsedEventHandler(timerMain_Elapsed);
// If the timer is declared in a long-running method, use
// KeepAlive to prevent garbage collection from occurring
// before the method ends.
GC.KeepAlive(timerMain);
}
示例14: ReadSections
/// <summary>
/// 读取指定节下的所有键值对
/// </summary>
/// <param name="path"></param>
/// <param name="section"></param>
/// <param name="values"></param>
public static void ReadSections(string path, string section, System.Collections.Specialized.NameValueCollection values)
{
System.Collections.Specialized.StringCollection keys = new System.Collections.Specialized.StringCollection();
ReadSections(path, section, keys);
values.Clear();
foreach (string key in keys)
{
values.Add(key, ReadIniValue(path, section, key));
}
}
示例15: CSharpStringCollectionNotCompiles
public void CSharpStringCollectionNotCompiles()
{
Stream stream = GetCSharpBadSample();
using (StreamReader sr = new StreamReader(stream))
{
System.Collections.Specialized.StringCollection references = new System.Collections.Specialized.StringCollection();
references.Add("System.dll");
CompilerAssert.NotCompiles(CompilerAssert.CSharpCompiler, references, sr.ReadToEnd());
}
}