本文整理汇总了C#中System.Collections.Specialized.StringCollection.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# StringCollection.Remove方法的具体用法?C# StringCollection.Remove怎么用?C# StringCollection.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Specialized.StringCollection
的用法示例。
在下文中一共展示了StringCollection.Remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UnregisterToCleanup
private void UnregisterToCleanup(string artifactName, StringCollection cleanupList)
{
lock (_syncObject)
{
cleanupList.Remove(artifactName);
}
}
示例2: Settings
public Settings()
{
InitializeComponent();
Closing += PreventTermination;
planetList = Properties.Settings.Default.planets;
System.Collections.IEnumerator se = Constraints.PLANETS.GetEnumerator();
while (se.MoveNext())
{
string pl = (string)se.Current;
CheckBox tmp = new CheckBox();
tmp.Checked += delegate(object s, RoutedEventArgs e)
{
if(planetList.IndexOf(pl) == -1) planetList.Add(pl);
};
tmp.Unchecked += delegate(object s, RoutedEventArgs e)
{
if(planetList.IndexOf(pl) > -1) planetList.Remove(pl);
};
tmp.IsChecked = planetList.IndexOf(pl) > -1;
StackPanel sp = new StackPanel();
sp.Orientation = Orientation.Horizontal;
sp.Children.Add(tmp);
Label lbl = new Label();
lbl.Content = pl;
sp.Children.Add(lbl);
planets.Children.Add(sp);
}
closetaskbar.IsChecked = Properties.Settings.Default.closeToTaskbar;
mintaskbar.IsChecked = Properties.Settings.Default.minimizeToTaskbar;
notify.IsChecked = Properties.Settings.Default.notify;
hasrewards.IsChecked = Properties.Settings.Default.hasRewards;
reward.Text = Properties.Settings.Default.rewardContains.ToLower();
credits.Text = Properties.Settings.Default.credits.ToString();
usefilter.IsChecked = Properties.Settings.Default.useFilter;
}
示例3: OnInferParametersButtonClick
private void OnInferParametersButtonClick(object sender, EventArgs e)
{
if (this._commandTextBox.Text.Trim().Length == 0)
{
UIServiceHelper.ShowError(base.ServiceProvider, System.Design.SR.GetString("SqlDataSourceQueryEditorForm_InferNeedsCommand"));
}
else
{
Parameter[] parameterArray = this._sqlDataSourceDesigner.InferParameterNames(this._dataConnection, this._commandTextBox.Text, this._commandType);
if (parameterArray != null)
{
Parameter[] parameters = this._parameterEditorUserControl.GetParameters();
StringCollection strings = new StringCollection();
foreach (Parameter parameter in parameters)
{
strings.Add(parameter.Name);
}
bool flag = true;
try
{
flag = SqlDataSourceDesigner.SupportsNamedParameters(SqlDataSourceDesigner.GetDbProviderFactory(this._dataConnection.ProviderName));
}
catch
{
}
if (flag)
{
List<Parameter> list = new List<Parameter>();
foreach (Parameter parameter2 in parameterArray)
{
if (!strings.Contains(parameter2.Name))
{
list.Add(parameter2);
}
else
{
strings.Remove(parameter2.Name);
}
}
this._parameterEditorUserControl.AddParameters(list.ToArray());
}
else
{
List<Parameter> list2 = new List<Parameter>();
foreach (Parameter parameter3 in parameterArray)
{
list2.Add(parameter3);
}
foreach (Parameter parameter4 in parameters)
{
Parameter item = null;
foreach (Parameter parameter6 in list2)
{
if (parameter6.Direction == parameter4.Direction)
{
item = parameter6;
break;
}
}
if (item != null)
{
list2.Remove(item);
}
}
this._parameterEditorUserControl.AddParameters(list2.ToArray());
}
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:69,代码来源:SqlDataSourceQueryEditorForm.cs
示例4: AddRecentlyUsedFile
public void AddRecentlyUsedFile(FileInfo newFile) {
StringCollection recent = new StringCollection();
recent.AddRange(data.RecentOpenedFiles);
while(recent.IndexOf(newFile.FullName) >= 0) {
recent.Remove(newFile.FullName);
}
recent.Insert(0, newFile.FullName);
while (recent.Count > 16) {
recent.RemoveAt(16);
}
string[] result = new string[recent.Count];
recent.CopyTo(result, 0);
data.RecentOpenedFiles = result;
}
示例5: CommitReversalEntriesText
/// <summary>
/// This method is called by the ReversalEntriesText virtual handler when text may have changed in the
/// property, in order to update the actual list of reversal entries appropriately.
/// </summary>
/// <param name="tssVal">The new string.</param>
/// <param name="ws">The ws.</param>
public void CommitReversalEntriesText(ITsString tssVal, int ws)
{
LexSenseReversalEntriesTextHandler vh = BaseVirtualHandler.GetInstalledHandler(m_cache,
"LexSense", LexSenseReversalEntriesTextHandler.StandardFieldName) as LexSenseReversalEntriesTextHandler;
Debug.Assert(vh != null, "The 'LexSenseReversalEntriesTextHandler' virtual handler has to be created at application startup now.");
ITsString tssOld = vh.GetValue(m_hvo, ws);
// The old and new values could be in another order, and this test won't catch that case.
// That condition won't be fatal, however, so don't fret about it.
if (tssOld.Equals(tssVal))
return; // no change has occurred
string val = tssVal.Text;
if (val == null)
val = ""; // This will effectively cause any extant entries for the given 'ws' to be removed in the end.
StringCollection formsColl = new StringCollection();
foreach (string form in val.Split(';'))
{
// These strings will be null, if there are two semi-colons together.
// Or, it may be just whitespace, if it is '; ;'.
if (form == null || form.Trim().Length == 0)
continue;
formsColl.Add(form.Trim());
}
int[] senseEntries = ReversalEntriesRC.HvoArray;
int originalSenseEntriesCount = senseEntries.Length;
int indexId;
DbOps.ReadOneIntFromCommand(m_cache, "SELECT id FROM ReversalIndex WHERE WritingSystem=?", ws, out indexId);
ReversalIndex revIndex;
if (indexId == 0)
{
// Create the missing reversal index instead of crashing. See LT-10186.
ILgWritingSystem lgws = LgWritingSystem.CreateFromDBObject(m_cache, ws);
IReversalIndex newIdx = m_cache.LangProject.LexDbOA.ReversalIndexesOC.Add(new ReversalIndex());
newIdx.WritingSystemRA = lgws;
// Copy any and all alternatives from lgws.Name to newIdx.Name
foreach (ILgWritingSystem lgwsLoop in m_cache.LanguageEncodings)
{
string lgsNameAlt = lgws.Name.GetAlternative(lgwsLoop.Hvo);
if (lgsNameAlt != null && lgsNameAlt.Length > 0)
newIdx.Name.SetAlternative(lgsNameAlt, lgws.Hvo);
}
revIndex = (ReversalIndex)newIdx;
}
else
{
revIndex = (ReversalIndex)CmObject.CreateFromDBObject(m_cache, indexId, false);
}
// We need the list of ReversalIndexEntries that this sense references, but which belong
// to another reversal index. Those hvos, plus any entry hvos from the given 'ws' that are reused,
// get put into 'survivingEntries'.
Set<int> survivingEntries = new Set<int>(originalSenseEntriesCount + formsColl.Count);
// 'entriesNeedingPropChangeBackRef' will hold the hvos of all ReversalIndexEntry objects that need to have
// their 'ReferringSenses' virtual property (re)computed.
// Any reversal index entry that gains or loses a reference will need this (re)computing.
List<int> entriesNeedingPropChangeBackRef = new List<int>(originalSenseEntriesCount + formsColl.Count);
foreach (int entryHvo in senseEntries)
{
// Use 'cheapo' FDO object maker, since it is supposed to all be in the cache already.
ReversalIndexEntry rie = (ReversalIndexEntry)CmObject.CreateFromDBObject(m_cache, entryHvo, false);
int wsIndex = 0;
int hvoIndex = m_cache.GetOwnerOfObjectOfClass(rie.Hvo, ReversalIndex.kclsidReversalIndex);
if (hvoIndex != 0)
wsIndex = m_cache.GetIntProperty(hvoIndex, (int)ReversalIndex.ReversalIndexTags.kflidWritingSystem);
if (wsIndex == ws)
{
string form = rie.LongName;
if (formsColl.Contains(form))
{
// Recycling an entry.
survivingEntries.Add(rie.Hvo);
formsColl.Remove(form); // Don't need to mess with it later on.
}
else
{
// It is being removed from the extant reference property,
// so needs to recompute its back ref virtual handler.
entriesNeedingPropChangeBackRef.Add(rie.Hvo);
}
}
else
{
// These are all in some other ws, so they certainly must survive (cf. LT-3391).
// Any entries that are reused will get added to this array later on.
survivingEntries.Add(rie.Hvo);
}
}
// Start Undoable section of code.
m_cache.BeginUndoTask(Strings.ksUndoMakeRevEntries, Strings.ksRedoMakeRevEntries);
ISilDataAccess sda = m_cache.MainCacheAccessor;
IActionHandler acth = sda.GetActionHandler();
//.........这里部分代码省略.........
示例6: AddSearchHistoryItem
// generic method to add a string to a history item
private void AddSearchHistoryItem(StringCollection history, string toAdd)
{
// add the item to the find history
if (history.Contains(toAdd)) {
// remove it so it gets added at the top
history.Remove(toAdd);
}
// make sure there is only 20
if (history.Count == historyLimit) {
history.RemoveAt(historyLimit - 1);
}
history.Insert(0, toAdd);
// update the drop down for the combobox
ListStore store = new ListStore (typeof (string));
for (int i = 0; i < history.Count; i ++)
store.AppendValues (history[i]);
if (history == findHistory)
searchPatternEntry.Completion.Model = store;
else if( history == replaceHistory)
replacePatternEntry.Completion.Model = store;
}
示例7: UpdateExtensionFilesIfNeeded
/// <summary>
/// Check for changed (or missing) files in the Extensions subdirectory (as
/// compared to the corresponding "Available Plugins" subdirectory).
/// </summary>
/// <param name="paths"></param>
/// <param name="pluginBaseDir"></param>
/// <param name="extensionBaseDir"></param>
private void UpdateExtensionFilesIfNeeded(StringCollection paths, string pluginBaseDir,
string extensionBaseDir)
{
if (paths.Count == 0)
return;
List<string> obsoletePaths = new List<string>();
foreach (string extensionPath in paths)
{
string pluginPathname = Path.Combine(pluginBaseDir, extensionPath);
pluginPathname = pluginPathname.Replace("Extensions", "Available Plugins");
if (File.Exists(pluginPathname))
{
string extensionPathname = Path.Combine(extensionBaseDir, extensionPath);
Debug.Assert(File.Exists(extensionPathname));
if (!FileUtils.AreFilesIdentical(pluginPathname, extensionPathname))
{
string extensionDir = Path.GetDirectoryName(extensionPathname);
Directory.Delete(extensionDir, true);
Directory.CreateDirectory(extensionDir);
File.Copy(pluginPathname, extensionPathname);
File.SetAttributes(extensionPathname, FileAttributes.Normal);
// plug-ins usually have localization strings-XX.xml files.
foreach (string pluginFile in Directory.GetFiles(Path.GetDirectoryName(pluginPathname), "strings-*.xml"))
{
string extensionFile = Path.Combine(extensionDir, Path.GetFileName(pluginFile));
File.Copy(pluginFile, extensionFile);
File.SetAttributes(extensionFile, FileAttributes.Normal);
}
}
}
else
{
obsoletePaths.Add(extensionPath);
}
}
foreach (string badPath in obsoletePaths)
paths.Remove(badPath);
}
示例8: AddSearchHistoryItem
// generic method to add a string to a history item
private void AddSearchHistoryItem(StringCollection history, string toAdd)
{
// add the item to the find history
if (history.Contains(toAdd)) {
// remove it so it gets added at the top
history.Remove(toAdd);
}
// make sure there is only 20
if (history.Count == HISTORY_LIMIT) {
history.RemoveAt(HISTORY_LIMIT - 1);
}
history.Insert(0, toAdd);
// update the drop down for the combobox
string[] stringArray = new string[history.Count];
history.CopyTo(stringArray, 0);
if (history == findHistory) {
searchPatternComboBox.SetPopdownStrings(stringArray);
} else if( history == replaceHistory) {
replacePatternComboBox.SetPopdownStrings(stringArray);
}
}
示例9: parseOLUrlCmd
/// <summary>
/// Decodes the commands and if necessary (re)starts the Attack.
/// Works with the Captures from RegEx.
/// </summary>
/// <param name="cmds">the CaptureCollection containing a collection of commands</param>
/// <param name="vals">the CaptureCollection containing a collection of values corresponding to the commands.</param>
/// <returns>True if the commands were successfully loaded. False in case of any error.</returns>
private bool parseOLUrlCmd(CaptureCollection cmds, CaptureCollection vals)
{
bool ret = false;
if ((cmds.Count == vals.Count) && (cmds.Count > 0))
{
StringCollection defaults = new StringCollection();
defaults.Add("targetip"); defaults.Add("targethost"); defaults.Add("timeout");
defaults.Add("subsite"); defaults.Add("message"); defaults.Add("port");
defaults.Add("method"); defaults.Add("threads"); defaults.Add("wait");
defaults.Add("random"); defaults.Add("speed"); defaults.Add("sockspthread");
defaults.Add("useget"); defaults.Add("usegzip");
int num = 0;
bool isnum = false;
bool restart = false;
bool ctdwndn = false;
string tval = "";
string tcmd = "";
for (int i = 0; i < cmds.Count; i++)
{
tval = vals[i].Value.Trim();
tcmd = cmds[i].Value.Trim();
defaults.Remove(tcmd);
switch (tcmd.ToLowerInvariant())
{
case "targetip":
if (txtTargetIP.Text != tval)
{
txtTargetIP.Text = tval;
LockOnIP(true);
restart = true;
}
ret = true;
break;
case "targethost":
if (txtTargetURL.Text != tval)
{
txtTargetURL.Text = tval;
LockOnURL(true);
restart = true;
}
ret = true;
break;
case "timeout":
isnum = int.TryParse(tval, out num);
if (isnum)
{
if (txtTimeout.Text != num.ToString())
{
txtTimeout.Text = num.ToString();
restart = true;
}
}
break;
case "subsite":
tval = Uri.UnescapeDataString(tval);
if (txtSubsite.Text != tval)
{
txtSubsite.Text = tval;
restart = true;
}
break;
case "message":
if (txtData.Text != tval)
{
txtData.Text = tval;
restart = true;
}
break;
case "port":
if (txtPort.Text != tval)
{
txtPort.Text = tval;
restart = true;
}
break;
case "method":
int index = cbMethod.FindString(tval);
if (index != -1)
{
if (cbMethod.SelectedIndex != index)
{
cbMethod.SelectedIndex = index;
restart = true;
}
}
break;
case "threads":
if (Functions.ParseInt(tval, 1, 99, out num))
{
if (txtThreads.Text != num.ToString())
{
//.........这里部分代码省略.........
示例10: ProcessFile
/// <summary>
/// Checks to see if the string collection contains the key file, and if it does
/// loads it and removes it from the collection.
/// </summary>
/// <param name="files">The list of files</param>
/// <param name="file">The key file to process</param>
private void ProcessFile(StringCollection files, string file)
{
if (files.Contains(file))
{
// Create the key, add it to our collection, and remove the
// file from the list as we've loaded it.
Key key = new Key(file);
keys.Add(key);
files.Remove(file);
}
}
示例11: SubtractRights
// subtract existing rights from the ones we want to set
public static string SubtractRights(string sExistingRights, string sNewRights)
{
StringCollection existingRights = new StringCollection();
existingRights.AddRange(sExistingRights.Split('|'));
StringCollection newRights = new StringCollection();
newRights.AddRange(sNewRights.Split('|'));
foreach (string sExistingRight in existingRights)
{
if (newRights.Contains(sExistingRight))
newRights.Remove(sExistingRight);
}
string sResult = "";
foreach (string sVal in newRights)
sResult += sVal + "|";
return sResult;
}
示例12: GetNextAvailableDriveLetter
/////////////////////////////////////////////////////
// //
// GetNextAvailableDriveLetter() //
// //
/////////////////////////////////////////////////////
//Description: Finds the next available drive letter
// on the current system.
//Returns: the drive letter w/o a colon
/////////////////////////////////////////////////////
public static string GetNextAvailableDriveLetter()
{
// build a string collection representing the alphabet
StringCollection alphabet = new StringCollection();
int lowerBound = Convert.ToInt16('g');
int upperBound = Convert.ToInt16('z');
for (int i = lowerBound; i < upperBound; i++)
{
char driveLetter = (char)i;
alphabet.Add(driveLetter.ToString());
}
// get all current drives
DriveInfo[] drives = DriveInfo.GetDrives();
foreach (DriveInfo drive in drives)
{
alphabet.Remove(drive.Name.Substring(0, 1).ToLower());
}
//if there is one available, return it; else null
if (alphabet.Count > 0)
return alphabet[0];
else
return null;
}
示例13: FindProductTemplates
public static StringCollection FindProductTemplates()
{
StringCollection result = new StringCollection();
result = ListFolders("BVModules\\ProductTemplates", "Product.aspx");
result.Remove("FixedPriceGiftCertificate");
result.Remove("ArbitraryPriceGiftCertificate");
return result;
}
示例14: GetImgLinks
public StringCollection GetImgLinks(string image)
{
StringCollection a = new StringCollection();
string src;
do
{
WebRequest(queryurl + "?what=imagelinks&titles=" + image + "&format=xml");
HttpWebResponse webResp1 = (HttpWebResponse)WebReq.GetResponse();
Stream srcstrm = webResp1.GetResponseStream();
StreamReader work = new StreamReader(srcstrm);
src = work.ReadToEnd();
MatchCollection mcpt = Ptitle.Matches(src);
foreach (Match m in mcpt)
{
string ms = m.Value;
ms = Regex.Replace(ms, "</il>", "");
ms = Regex.Replace(ms, "<il n?s?=?\"?[0|1|2|3|4|5|6|7|8|9]*?\"? ?id=\"[0|1|2|3|4|5|6|7|8|9]*\">", "");
a.Add(ms);
}
}
while (NextPortion.IsMatch(src));
a.Remove(image);
return a;
}
示例15: Flush
/// <summary>
/// Removes all the element from the IScope object.
/// </summary>
public void Flush()
{
TraceUtil.Log("Flush session scope.");
StringCollection toRemove = new StringCollection();
StringCollection names = (StringCollection)WebUtil.GetCurrentHttpContext().Items[COMPONENT_NAMES];
foreach (string name in names)
{
WebUtil.GetCurrentHttpContext().Session.Remove(SESSION_SCOPE_SUFFIX + name);
toRemove.Remove(name);
}
names.Clear();
}