当前位置: 首页>>代码示例>>C#>>正文


C# KeyValuePair.Equals方法代码示例

本文整理汇总了C#中KeyValuePair.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# KeyValuePair.Equals方法的具体用法?C# KeyValuePair.Equals怎么用?C# KeyValuePair.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KeyValuePair的用法示例。


在下文中一共展示了KeyValuePair.Equals方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AnalyAndReplace

        /// <summary>
        /// 根据模板分析,并且返回已替换内容
        /// </summary>
        /// <param name="content"></param>
        /// <param name="regex"></param>
        /// <param name="modelInfo"></param>
        /// <param name="TransferFactory"></param>
        /// <returns></returns>
        public string AnalyAndReplace(string content, string regex, EntityInfo entity, Object obj, IExTransferFactory TransferFactory)
        {
            string Result = "";

            Dictionary<int, string> expresses = content.RegBaseDic(@regex); ;
            
            Dictionary<int, int> patternS_E = AnaUtil.Instance().GetKeyIndVal(expresses);

            Result += patternS_E.Count > 0 ? content.Substring(0, patternS_E.ElementAt(0).Key) : "";

            KeyValuePair<int, int> S_EPair = new KeyValuePair<int, int>();
            KeyValuePair<int, int> S_EPair2 = new KeyValuePair<int, int>();
            for (int i = 0; i < expresses.Count; i++)
            {
                Result += TransferFactory.CreateTransfer(expresses.ElementAt(i).Value).Transfer(expresses.ElementAt(i).Value, entity, obj);
                S_EPair = patternS_E.ElementAt(i);
                S_EPair2 = patternS_E.Count > (i + 1) ? patternS_E.ElementAt(i + 1) : patternS_E.ElementAt(i);

                Result += S_EPair2.Equals(S_EPair) ? "" : content.Substring(S_EPair.Value, S_EPair2.Key - S_EPair.Value);
            }
            Result += patternS_E.Count > 0 ? content.Substring(S_EPair.Value, content.Length - S_EPair.Value) : "";

            Result = patternS_E.Count == 0 ? content : Result;

            return Result;
        }
开发者ID:Dhenskr,项目名称:hoyi-er-tool,代码行数:34,代码来源:ContentAnalysis.cs

示例2: callSong

    public void callSong(NetworkPlayer player, string name, string subtitle, int step, int difficulty, int level)
    {
        if(!isSearching)
        {
            var theSIP = new SongInfoProfil(name, subtitle, step, (Difficulty)difficulty, level);
            if(lastSongChecked.Equals(default(KeyValuePair<Difficulty, Dictionary<Difficulty, Song>>)) || !lastSongChecked.Value[lastSongChecked.Key].sip.CompareId(theSIP))
            {
                for(int i=0; i < LANManager.Instance.players.Count; i++)
                {
                    LANManager.Instance.players.ElementAt(i).Value.songChecked = 0;
                }
                isSearching = true;
                networkView.RPC("setSearching", RPCMode.Others, true);
                networkView.RPC ("checkSong", RPCMode.Others, name, subtitle, step, difficulty, level);
                playerSearching = player;
                lastSongChecked = LoadManager.Instance.FindSong(theSIP);
                LANManager.Instance.players[Network.player].songChecked = lastSongChecked.Equals(default(KeyValuePair<Difficulty, Dictionary<Difficulty, Song>>)) ? 2 : 1;

            }else
            {
                isSearching = true;
                playerSearching = player;
            }

        }
    }
开发者ID:BenouKat,项目名称:Unity-ITGHD,代码行数:26,代码来源:NetworkWheelScript.cs

示例3: checkSong

 void checkSong(string name, string subtitle, int step, int difficulty, int level)
 {
     lastSongChecked = LoadManager.Instance.FindSong(new SongInfoProfil(name, subtitle, step, (Difficulty)difficulty, level));
     var getSong = !lastSongChecked.Equals(default(KeyValuePair<Difficulty, Dictionary<Difficulty, Song>>));
     networkView.RPC("getSongCheckResult", RPCMode.Server, Network.player, getSong);
 }
开发者ID:BenouKat,项目名称:Unity-ITGHD,代码行数:6,代码来源:NetworkWheelScript.cs

示例4: ContactKeyValueIsNull

 public bool ContactKeyValueIsNull(KeyValuePair<string, Contact> contactKeyValue)
 {
     if (contactKeyValue.Equals(new KeyValuePair<string, Contact>())) return true;
     return false;
 }
开发者ID:danpamfil,项目名称:JuniorMind,代码行数:5,代码来源:ContactListPageApiModel.cs

示例5: KeyHasValue

        private static bool KeyHasValue(KeyValuePair<string, string> kvp)
        {
            if (!kvp.Equals(default(KeyValuePair<string, string>)) && !string.IsNullOrEmpty(kvp.Value))
            {
                return true;
            }

            return false;
        }
开发者ID:WilsonTay,项目名称:Test,代码行数:9,代码来源:DealApiController.cs

示例6: Test_Find_ShouldReturnEqualKeyValue

 public void Test_Find_ShouldReturnEqualKeyValue()
 {
     hashTable.Add(key1, value1);
     var result = hashTable.Find(key1);
     var pair = new KeyValuePair<string, string>(key1, value1);
     Assert.IsTrue(pair.Equals(result), "Hash table find() should return equal key when found.");
 }
开发者ID:bstaykov,项目名称:Telerik-DSA,代码行数:7,代码来源:HashTableTests.cs

示例7: AddListItemForPair

        private void AddListItemForPair(XElement xKey, XElement xValue)
        {
            ValueEditor keyEditor = ValueEditor.CreateEditor(dictionaryValueType.KeyType, new ValueValidatorAttribute[0], xDefaultKey);
            keyEditor.ReadFromXElement(xKey);
            keyEditor.ValueChanged += delegate { RaiseValueChanged(); };

            ValueEditor valueEditor = ValueEditor.CreateEditor(dictionaryValueType.ValueType, new ValueValidatorAttribute[0], xDefaultValue);
            valueEditor.ReadFromXElement(xValue);
            valueEditor.ValueChanged += delegate { RaiseValueChanged(); };

            var editorsPair = new KeyValuePair<ValueEditor, ValueEditor>(keyEditor, valueEditor);

            Button uiRemove = new Button {
                Content = new Image {
                    Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("pack://application:,,,/ObjectConfigurator;component/Resources/delete.png")),
                    Width = 12,
                    Margin = new Thickness(1)
                },
                Margin = new Thickness(2, 0, 0, 0)
            };
            uiRemove.Click += delegate {
                Border itemToRemove = uiItems.Children.OfType<Border>().First(i => editorsPair.Equals(i.Tag));
                uiItems.Children.Remove(itemToRemove);
                CheckErrors();
                RaiseValueChanged();
            };
            Grid.SetColumn(uiRemove, 2);

            Grid.SetColumn(valueEditor.Representation, 1);
            valueEditor.Representation.Margin = new Thickness(5, 0, 0, 0);
            Border item = new Border {
                Tag = editorsPair,
                Child = new Grid {
                    ColumnDefinitions = {
                        new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
                        new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
                        new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) },
                    },
                    Children = {
                        keyEditor.Representation,
                        valueEditor.Representation,
                        uiRemove
                    }
                },
                Margin = new Thickness(2, 2, 2, 2)
            };
            uiItems.Children.Insert(uiItems.Children.Count - 1, item);
        }
开发者ID:bzamecnik,项目名称:XRouter,代码行数:48,代码来源:DictionaryValueEditor.cs

示例8: FindOutOfRangePoint

 private static bool FindOutOfRangePoint(IEnumerable<KeyValuePair<DateTime, double>> dataPoints, double minLevel, double maxLevel, out KeyValuePair<DateTime, double> outOfRangePoint)
 {
     outOfRangePoint = dataPoints.FirstOrDefault(kv => (kv.Value < minLevel) || (kv.Value > maxLevel));
     if (outOfRangePoint.Equals(default(KeyValuePair<DateTime, double>)))
         return false;
     else
         return true;
 }
开发者ID:softage,项目名称:Orcomp,代码行数:8,代码来源:TaskCollectionExtensions.cs

示例9: filter_Processes

        /// <summary>
        /// As the user types we want to filter the processes to those that contain the users search
        /// If its less than two characters, search for title starting with those characters for a "fast switch" type feel
        /// </summary>
        private void filter_Processes(object sender, FilterEventArgs e)
        {
            KeyValuePair<IntPtr, string> p = new KeyValuePair<IntPtr,string>();
            try
            {
                p = (KeyValuePair<IntPtr, string>)e.Item;
            }
            catch
            {
                e.Accepted = false;
                return;
            }

            Debug.Assert(!p.Equals(default(KeyValuePair<IntPtr, string>)));
            if (string.IsNullOrEmpty(ProcessUserInput)) { e.Accepted = true; return; }

            e.Accepted = ProcessUserInput.Length < 2 ? p.Value.ToUpper().StartsWith(ProcessUserInput.ToUpper()) : p.Value.ToUpper().Contains(ProcessUserInput.ToUpper());
        }
开发者ID:SamTwining,项目名称:WindowButler,代码行数:22,代码来源:ButlerVM.cs

示例10: FindClosestBirthday

        public Task<Message[]> FindClosestBirthday(Channel channel)
        {
            Server s = channel.Server;
            if (Miku_Bot.birthdays[s].Count == 0)
            {
                return client.SendMessage(channel, "No birthday has been added for this server");
            }

            else
            {
                DateTime today = DateTime.Today;
                List<KeyValuePair<string, DateTime>> same = new List<KeyValuePair<string, DateTime>>();
                List<KeyValuePair<string, DateTime>> same2 = new List<KeyValuePair<string, DateTime>>();
                KeyValuePair<string, DateTime> next = new KeyValuePair<string, DateTime>("", DateTime.MaxValue);
                KeyValuePair<string, DateTime> min = new KeyValuePair<string, DateTime>("", DateTime.MaxValue);

                foreach (KeyValuePair<string, DateTime> bday in Miku_Bot.birthdays[s])
                {
                    DateTime temp = new DateTime(today.Year, bday.Value.Month, bday.Value.Day);
                    Console.Write($"{bday.Key}");
                    if (temp.Month > today.Month)
                    {

                        if (temp.Month == next.Value.Month && temp.Day == next.Value.Day)
                        {
                            same.Add(bday);
                        }

                        else if (temp.Month < next.Value.Month)
                        {
                            next = bday;
                            same.Clear();
                            same.Add(next);
                        }

                        else if (temp.Month == next.Value.Month && temp.Day < next.Value.Day)
                        {
                            next = bday;
                            same.Clear();
                            same.Add(next);
                        }
                    }

                    else if (temp.Month == today.Month && temp.Day > today.Day)
                    {
                        if (temp.Month == next.Value.Month && temp.Day == next.Value.Day)
                        {
                            same.Add(bday);
                        }

                        else if (temp.Month < next.Value.Month)
                        {
                            next = bday;
                            same.Clear();
                            same.Add(next);
                        }

                        else if (temp.Month == next.Value.Month && temp.Day < next.Value.Day)
                        {
                            next = bday;
                            same.Clear();
                            same.Add(next);
                        }
                    }

                    if (temp.Month == min.Value.Month && temp.Day == min.Value.Day)
                    {
                        same2.Add(bday);
                    }

                    else if (temp.Month < min.Value.Month)
                    {
                        min = bday;
                        same2.Clear();
                        same2.Add(min);
                    }

                    else if (temp.Month == min.Value.Month && temp.Day < min.Value.Day)
                    {
                        min = bday;
                        same2.Clear();
                        same2.Add(min);
                    }
                }

                if (next.Value == DateTime.MaxValue)
                {
                    next = min;
                }

                string message = "Next birthday is";
                if (!next.Equals(min))
                {
                    if (same2.Count == 1)
                    {
                        message += $" {same2[0].Key} on {same2[0].Value.Month}/{same2[0].Value.Day}";
                    }
                    else
                    {
                        message += ":";
//.........这里部分代码省略.........
开发者ID:auchiyam,项目名称:MikuBot,代码行数:101,代码来源:BotCommands.cs

示例11: GetReferencedVariablesForStatement

        private List<string> GetReferencedVariablesForStatement(KeyValuePair<int, List<VariableLine>> statementLinesMapping)
        {
            if (statementLinesMapping.Equals(null))
                throw new ArgumentNullException("statementLinesMapping");

            List<string> referencedVariable = new List<string>();
            foreach (VariableLine statementLine in statementLinesMapping.Value)
                referencedVariable.Add(statementLine.variable);
            return referencedVariable;
        }
开发者ID:samuto,项目名称:designscript,代码行数:10,代码来源:CodeBlockNode.cs

示例12: TryFindByKey

        private bool TryFindByKey( string key, out KeyValuePair<string, string> header )
        {
            header = default( KeyValuePair<string, string> );

            if ( _headers != null )
            {
                header =
                    _headers.FirstOrDefault(
                        s => s.Key.Equals( key, StringComparison.InvariantCultureIgnoreCase ) );
            }

            return !header.Equals( default( KeyValuePair<string, string> ) );
        }
开发者ID:williamoneill,项目名称:Gallatin,代码行数:13,代码来源:HttpHeaders.cs

示例13: Last

 //=======================================================================
 // Support functions
 //=======================================================================
 /// <summary>
 /// Test if the item is last in the collection
 /// </summary>
 /// <returns>True if it is last</returns>
 private bool Last( 
     KeyValuePair<string, string> item, 
     KeyValuePair<string, string>[] collection )
 {
     int collectionCount = collection.Length;
     if ( item.Equals( collection[ collectionCount - 1 ] ) )
         return true;
     return false;
 }
开发者ID:Dracontis,项目名称:LoanService,代码行数:16,代码来源:BaseSqlDatabaseModel.cs

示例14: HaveCodeMatch

        private static bool HaveCodeMatch(string codeToMatch, KeyValuePair<string, string> codeResponse)
        {
            if (!codeResponse.Equals(default(KeyValuePair<string, string>)))
            {
                return codeResponse.Key.Equals(codeToMatch, StringComparison.InvariantCultureIgnoreCase) || codeResponse.Value.Equals(codeToMatch, StringComparison.InvariantCultureIgnoreCase);
            }

            return false;
        }
开发者ID:martinrayenglish,项目名称:301RedirectModule,代码行数:9,代码来源:Redirects.cs


注:本文中的KeyValuePair.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。