本文整理汇总了C#中System.Collections.Dictionary.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# Dictionary.Clear方法的具体用法?C# Dictionary.Clear怎么用?C# Dictionary.Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Dictionary
的用法示例。
在下文中一共展示了Dictionary.Clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DelYsxx
public bool DelYsxx(string itemCode, WorkFlowNode ysType)
{
ArrayList sqls = new ArrayList();
string tmpSql;
Dictionary<string, string> delCondition = new Dictionary<string, string>();
delCondition.Clear();
delCondition.Add("itemcode", itemCode);
sqls.Add(SqlBuilder.BuildDeleteSql<Xm_Ysxx>(delCondition));
delCondition.Clear();
delCondition.Add("itemcode", itemCode);
delCondition.Add("xh", "1");
delCondition.Add("stage", ((int)ItemStage.YanShou).ToString());
sqls.Add(SqlBuilder.BuildDeleteSql<Xm_Gcxx>(delCondition));
//清空项目所有的文件。
tmpSql = "delete from item_file where itemcode = '{0}' and nodeid = '{1}'";
tmpSql = string.Format(tmpSql, itemCode, (int)ysType);
sqls.Add(tmpSql);
if (ysType == WorkFlowNode.ChuYan)
{
//清空项目所有的文件。
tmpSql = "delete from item_file where itemcode = '{0}' and nodeid = '{1}' and filecode not in ('24','25','26')";
tmpSql = string.Format(tmpSql, itemCode, (int)WorkFlowNode.JunGong);
sqls.Add(tmpSql);
}
return OracleHelper.ExecuteCommand(sqls);
}
示例2: PreferencesManager
public PreferencesManager()
{
_terrains = (byte)PlayerPrefs.GetInt(TERRAINS,1);
_operations = (byte)PlayerPrefs.GetInt(OPERATIONS,15);
_tileNum = PlayerPrefs.GetInt(TILES,1);
_eqFormat = PlayerPrefs.GetInt(EQ_FORMAT,0);
_numWin = PlayerPrefs.GetInt(NUM_WIN,25);
_alienSpeed = PlayerPrefs.GetFloat(ALIENSPEED ,0.5f);
_mathiusTexturesInt = PlayerPrefs.GetInt(TEXTUREINT,0);
_usePerceptual = (PlayerPrefs.GetInt(USEPERCEPTUAL,0).Equals(0)) ? false : true;
_musicVolume = PlayerPrefs.GetFloat(MUSICVOLUME,0.5f);
_SFXVolume = PlayerPrefs.GetFloat(SFXVOLUME,0.5f);
_mute = (PlayerPrefs.GetInt(MUTE,0).Equals(1)) ? true : false;
_pVolume = new Dictionary<int, float>();
_pVolume.Clear();
_pVolume.Add (0,0.0f);
_pVolume.Add (1,0.5f);
_pVolume.Add (2,1.0f);
int state = PlayerPrefs.GetInt(PERCEPTUALVOLUME,0);
_perceptualVolume = _pVolume[state];
_pVolumeMode = state;
}
示例3: SkyBoxManager
public SkyBoxManager(Material[] materials)
{
_skyboxMap = new Dictionary<string, SkyBoxes> ();
_skyboxMap.Clear();
_skyboxes = materials;
_current = null;
}
示例4: getUniText
void getUniText()
{
Dictionary<string,string> tempDict = new Dictionary<string, string> ();
var asset = uniText;
if (asset == null)
Debug.LogError ("Could not find json unitext file");
else {
var jsonString = asset.text;
var decodedHash = jsonString.hashtableFromJson ();
if (decodedHash == null)
Debug.LogError ("Is not json file");
else {
var unitext = (IDictionary)decodedHash ["unitext"];
if (unitext == null)
Debug.LogError ("Is not json unitext file");
else
foreach (System.Collections.DictionaryEntry item in unitext) {
var lang = (IDictionary)((IDictionary)item.Value);
if (lang == null)
Debug.LogError ("Is not json unitext file");
else if (item.Key.ToString () == currentLang) {
tempDict.Clear ();
foreach (System.Collections.DictionaryEntry phrase in lang) {
tempDict.Add (phrase.Key.ToString (), phrase.Value.ToString ());
}
uniDict.Add (item.Key.ToString (), tempDict);
}
//Debug.Log("lang load:"+item.Key.ToString ());
}
asset = null;
Resources.UnloadUnusedAssets ();
}
}
}
示例5: TestReplaceTags
public void TestReplaceTags()
{
var tagsCaseSensitive = new Dictionary<string, string>(StringComparer.InvariantCulture);
tagsCaseSensitive["foo1"] = "bar1";
tagsCaseSensitive["foo2"] = "bar2";
tagsCaseSensitive["FOO3"] = "bar3";
var tagsCaseInsensitive = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
tagsCaseInsensitive["foo1"] = "bar1";
tagsCaseInsensitive["foo2"] = "bar2";
tagsCaseInsensitive["FOO3"] = "bar3";
string prefix = "$(";
string suffix = ")";
string source = "$(foo1) $(foo2) $(foo3) $(foo1)$(foo2)$(foo3)$(foo1)";
Assert.AreEqual("bar1 bar2 $(foo3) bar1bar2$(foo3)bar1", StringUtility.ReplaceTags(source, prefix, suffix, tagsCaseSensitive, TaggedStringOptions.LeaveUnknownTags));
Assert.AreEqual("bar1 bar2 bar3 bar1bar2bar3bar1", StringUtility.ReplaceTags(source, prefix, suffix, tagsCaseInsensitive, TaggedStringOptions.LeaveUnknownTags));
Assert.AreEqual("bar1 bar2 bar1bar2bar1", StringUtility.ReplaceTags(source, prefix, suffix, tagsCaseSensitive, TaggedStringOptions.RemoveUnknownTags));
tagsCaseInsensitive.Clear();
tagsCaseInsensitive["salt"] = "salt";
prefix = "%";
suffix = "%";
source = "%salt%%salt%%pepper%%pepper%%salt%%pepper%";
Assert.AreEqual("saltsaltsalt", StringUtility.ReplaceTags(source, prefix, suffix, tagsCaseInsensitive, TaggedStringOptions.RemoveUnknownTags));
}
示例6: PosTest2
public bool PosTest2()
{
bool retVal = true;
TestLibrary.TestFramework.BeginScenario("PosTest2: Using Dictionary<Int32,Byte> to implemented the clear method");
try
{
IDictionary iDictionary = new Dictionary<Int32,Byte>();
Int32[] key = new Int32[1000];
Byte[] value = new Byte[1000];
for (int i = 0; i < 1000; i++)
{
key[i] = i;
}
TestLibrary.Generator.GetBytes(-55, value);
for (int i = 0; i < 1000; i++)
{
iDictionary.Add(key[i], value[i]);
}
iDictionary.Clear();
if (iDictionary.Count != 0)
{
TestLibrary.TestFramework.LogError("003", "The result is not the value as expected ");
retVal = false;
}
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("004", "Unexpected exception: " + e);
retVal = false;
}
return retVal;
}
示例7: LoadTextAsset
static bool LoadTextAsset(TextAsset textAsset, Dictionary<string, string> dic)
{
if (textAsset == null || dic == null)
return false;
char[] separator1 = new char[] { '\n' };
char[] separator2 = new char[] { '=' };
string[] sArr1 = textAsset.text.Split(separator1);
dic.Clear();
for (int i=0; i<sArr1.Length; i++) {
string line = sArr1[i];
string[] sArr2 = line.Split(separator2);
if (sArr2.Length < 2)
continue;
string akey = sArr2[0].Trim();
string avalue = sArr2[1].Trim();
if (!dic.ContainsKey(akey))
dic.Add(akey, avalue);
else
Debug.LogError(string.Format("{0}存在相同的key={1}", textAsset.name, akey) );
}
return true;
}
示例8: EnumerateClouds
internal PnrpResolveScope EnumerateClouds(bool forResolve, Dictionary<uint, string> LinkCloudNames, Dictionary<uint, string> SiteCloudNames)
{
bool flag = false;
PnrpResolveScope none = PnrpResolveScope.None;
LinkCloudNames.Clear();
SiteCloudNames.Clear();
UnsafePnrpNativeMethods.CloudInfo[] clouds = UnsafePnrpNativeMethods.PeerCloudEnumerator.GetClouds();
if (forResolve)
{
foreach (UnsafePnrpNativeMethods.CloudInfo info in clouds)
{
if (info.State == UnsafePnrpNativeMethods.PnrpCloudState.Active)
{
if (info.Scope == UnsafePnrpNativeMethods.PnrpScope.Global)
{
none |= PnrpResolveScope.Global;
flag = true;
}
else if (info.Scope == UnsafePnrpNativeMethods.PnrpScope.LinkLocal)
{
LinkCloudNames.Add(info.ScopeId, info.Name);
none |= PnrpResolveScope.LinkLocal;
flag = true;
}
else if (info.Scope == UnsafePnrpNativeMethods.PnrpScope.SiteLocal)
{
SiteCloudNames.Add(info.ScopeId, info.Name);
none |= PnrpResolveScope.SiteLocal;
flag = true;
}
}
}
}
if (!flag)
{
foreach (UnsafePnrpNativeMethods.CloudInfo info2 in clouds)
{
if (((info2.State != UnsafePnrpNativeMethods.PnrpCloudState.Dead) && (info2.State != UnsafePnrpNativeMethods.PnrpCloudState.Disabled)) && (info2.State != UnsafePnrpNativeMethods.PnrpCloudState.NoNet))
{
if (info2.Scope == UnsafePnrpNativeMethods.PnrpScope.Global)
{
none |= PnrpResolveScope.Global;
}
else if (info2.Scope == UnsafePnrpNativeMethods.PnrpScope.LinkLocal)
{
LinkCloudNames.Add(info2.ScopeId, info2.Name);
none |= PnrpResolveScope.LinkLocal;
}
else if (info2.Scope == UnsafePnrpNativeMethods.PnrpScope.SiteLocal)
{
SiteCloudNames.Add(info2.ScopeId, info2.Name);
none |= PnrpResolveScope.SiteLocal;
}
}
}
}
return none;
}
示例9: Start
void Start()
{
PLAY_ON_GAMEOBJECT = gameObject.transform.position;
audioVolume = 1.0f;
audioMapping = new Dictionary<string, AudioClip>();
audioMapping.Clear();
foreach(AudioClip ac in sounds){
audioMapping.Add(ac.name,ac);
}
}
示例10: FilldcInfTariffInfo
public static void FilldcInfTariffInfo(TrudoyomkostDBContext dbcontext, ref Dictionary<InfTariffInfo, double> dcInfTariffInfo)
{
var tempResult = from inftariff in dbcontext.InfTariff
select inftariff;
dcInfTariffInfo.Clear();
foreach (var item in tempResult)
if (!dcInfTariffInfo.ContainsKey(new InfTariffInfo(item.TariffNetNum, item.KindPay, item.WorkerRate)))
{
dcInfTariffInfo.Add(new InfTariffInfo(item.TariffNetNum, item.KindPay, item.WorkerRate), item.HourCost);
}
}
示例11: cargarStories
void cargarStories(Dictionary<int,UserStory> stories,Dictionary<int,bool> selected)
{
stories.Clear();
selected.Clear();
ArrayList lista=(ArrayList) MultiPlayer.Instance.getListaSprints();
Sprint sprint0=(Sprint) lista[0];
ArrayList listastories=sprint0.getListaStories();
for(int i=0;i<listastories.Count;i++){
UserStory user=(UserStory) listastories[i];
stories.Add((int)user.getId_UserStory(),user);
selected.Add((int)user.getId_UserStory(),false);
}
}
示例12: UserEngine
private Dictionary<UInt32, TempPlayObject> m_DicTempPlayObject = null; //临时角色信息
#endregion Fields
#region Constructors
public UserEngine()
{
m_DicPlayerObject = new Dictionary<UInt32, PlayerObject>();
m_DicPlayerObject.Clear();
m_DicTempPlayObject = new Dictionary<UInt32, TempPlayObject>();
m_DicTempPlayObject.Clear();
mListCacheRole = new List<PlayerObject>();
mListCacheRole.Clear();
mListSaveRole = new List<PlayerObject>();
mnCachePlaySaveTick = System.Environment.TickCount;
}
示例13: GUIManager
public GUIManager(GUISkin skin)
{
pointer = "";
this.skin = skin;
GUIObjects = new Dictionary<string, GUIProperties>();
GUIObjects.Clear();
scrollmap = new Dictionary<string, DirectionScroller>();
scrollmap.Clear ();
texture = new Texture2D(1,1); //texture set to red here.
texture.SetPixel(0,0,Color.red);
texture.Apply();
}
示例14: FillUpWithSameComp
IEnumerator FillUpWithSameComp(int hullID)
{
print("Running Test: FillUpWithSameComp");
Dictionary<int, int> slotVerificationTable = new Dictionary<int, int>();
MethodInfo AddCompMethod = typeof(ShipDesignSystem).GetMethod("AddCompToDisplay", BindingFlags.NonPublic | BindingFlags.Instance);
foreach (var compEntry in compTable)
{
print("Testing " + compEntry.Value.componentName);
slotVerificationTable.Clear();
ShipDesignSystem.Instance.BuildHull(hullID);
Hull buildingHull = typeof(ShipDesignSystem).GetField("currentHull", BindingFlags.NonPublic | BindingFlags.Instance)
.GetValue(ShipDesignSystem.Instance) as Hull;
ShipBlueprint shipBP = typeof(ShipDesignSystem).GetField("currentBlueprint", BindingFlags.Instance | BindingFlags.NonPublic)
.GetValue(ShipDesignSystem.Instance) as ShipBlueprint;
foreach (var slotEntry in buildingHull.SlotTable)
{
AddCompMethod.Invoke(ShipDesignSystem.Instance, new object[] { slotEntry.Value, compEntry.Value });
shipBP.AddComponent(compEntry.Value, slotEntry.Value);
slotVerificationTable.Add(slotEntry.Key, compEntry.Key);
yield return null;
}
StringBuilder sb = new StringBuilder("Test_FillUpWithSameComp_Hull_");
sb.Append(hullTable[hullID].name);
sb.Append("_Comp_");
sb.Append(compEntry.Value.componentName);
string fileName = sb.ToString();
ShipDesignSystem.Instance.DeleteBlueprint(fileName);
ShipDesignSystem.Instance.SaveBlueprint(fileName);
ShipDesignSystem.Instance.ClearBlueprint();
yield return new WaitForSeconds(0.2f);
ShipDesignSystem.Instance.LoadBlueprint(fileName);
ShipBlueprint loadedBP = typeof(ShipDesignSystem).GetField("currentBlueprint", BindingFlags.Instance | BindingFlags.NonPublic)
.GetValue(ShipDesignSystem.Instance) as ShipBlueprint;
yield return new WaitForSeconds(0.2f);
if (!VerifyLoadedBlueprint(loadedBP, slotVerificationTable, hullID))
{
Debug.LogError("Error in Test: FillUpWithSameComp - Loaded blueprint does not match ");
Debug.Break();
}
else
{
Debug.Log("Loaded Blueprint matches");
}
ShipDesignSystem.Instance.DeleteBlueprint(fileName);
ShipDesignSystem.Instance.ClearBlueprint();
}
}
示例15: LoadNames
protected static void LoadNames(bool isFemale)
{
Dictionary<string, bool> names = new Dictionary<string, bool>();
LoadHumanFirstNames(isFemale, names);
sNames.AddNames(CASAgeGenderFlags.Human, isFemale, names);
foreach (CASAgeGenderFlags species in new CASAgeGenderFlags[] { CASAgeGenderFlags.Cat, CASAgeGenderFlags.Dog, CASAgeGenderFlags.LittleDog, CASAgeGenderFlags.Horse })
{
names.Clear();
LoadPetFirstNames(isFemale, species, names);
sNames.AddNames(species, isFemale, names);
}
//BooterLogger.AddError(sNames.ToString());
}