System.Collections.Generic.List.Contains(dynamic)

Here are the examples of the csharp api System.Collections.Generic.List.Contains(dynamic) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

19 Source : ConsoleCommands.cs
with GNU General Public License v3.0
from Albo1125

[Rage.Attributes.ConsoleCommand("Starts the LSPDFR callout with the specified callout name.")]
        private static void Command_StartCallout([ConsoleCommandParameter(AutoCompleterType = typeof(CalloutNameAutoCompleter))] string CalloutName)
        {
            if (GetRegisteredCalloutNames().Contains(CalloutName))
            {
                Game.LogTrivial("[replacedorted Callouts.StartCallout]: Starting callout: " + CalloutName);
                Functions.StartCallout(CalloutName);
            }
            else
            {
                Game.LogTrivial("[replacedorted Callouts.StartCallout]: " + CalloutName + " is not a registered callout.");
            }
        }

19 Source : General.cs
with Apache License 2.0
from Ginger-Automation

public static void FillComboFromEnumObj(ComboBox comboBox, Object EnumObj, List<object> values = null, bool sortValues = true, ListCollectionView valuesCollView = null, List<dynamic> excludeList= null)
        {
            comboBox.SelectedValuePath = "Value";
            Type Etype = EnumObj.GetType();

            if ((values == null) && (valuesCollView == null))
            {
                comboBox.Items.Clear();
                // Get all possible enum vals
                foreach (object item in Enum.GetValues(Etype))
                {
                    if (excludeList != null && excludeList.Contains(item))
                    {
                        continue;
                    }
                    ComboEnumItem CEI = new ComboEnumItem();
                    CEI.text = GetEnumValueDescription(Etype, item);
                    CEI.Value = item;
                    comboBox.Items.Add(CEI);
                }
            }
            else
            {
                if ((values == null) && (valuesCollView != null))
                {
                    comboBox.ItemsSource = valuesCollView;
                }
                else
                {
                    comboBox.Items.Clear();
                    // get only subset from selected enum vals - used in Edit Action locate by to limit to valid values
                    foreach (object item in values)
                    {
                        if (excludeList != null && excludeList.Contains(item))
                        {
                            continue;
                        }
                        ComboEnumItem CEI = new ComboEnumItem();
                        CEI.text = GetEnumValueDescription(Etype, item);
                        CEI.Value = item;
                        comboBox.Items.Add(CEI);
                    }
                }
            }

            if (sortValues)
            {
                // Get the combo to be sorted
                comboBox.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription("text", System.ComponentModel.ListSortDirection.Ascending));
            }

            //if ((values == null) && (valuesCollView != null))
            //{
                comboBox.SelectedItem = EnumObj;
            //}
            //else
            //{
            //    comboBox.SelectedValue = EnumObj;
            //}
        }

19 Source : Weather.cs
with GNU General Public License v3.0
from GreyWolfDev

public static CommandResponse GetFknWeather(string location)
        {

            dynamic phrases = JsonConvert.DeserializeObject(new StreamReader(Path.GetDirectoryName(replacedembly.GetExecutingreplacedembly().Location) + "\\Resources\\fw.json").ReadToEnd());
            var url = $"https://api.openweathermap.org/data/2.5/weather?appid={ApiKey}&";
            //check if location is coords
            if (location.Contains(","))
            {
                if (location.Split(',')[1].Contains("."))
                {
                    url += $"lat={location.Split(',')[0]}&lon={location.Split(',')[1]}";
                }
                else
                    url += $"zip={location},us";
            }
            else
                url += $"zip={location},us";
            var c = Parse(url);
            if (!String.IsNullOrEmpty(c.name))
            {

                var result = $"Conditions for *{c.name}*:\n{c.weather[0].description} {(int)c.main.temp}°F\n";
                //now the tricky bits.
                var tempF = c.main.temp;
                var tempC = 5.0 / 9.0 * (tempF - 32);
                var choices = new List<dynamic>();
                foreach (var phrase in phrases.phrases)
                {
                    //first match on conditions...
                    if (phrase.condition != null && c.weather[0].description.ToLower().Contains(phrase.condition.ToString()))
                    {
                        if (phrase.min != null)
                        {
                            var min = Int32.Parse(phrase.min.ToString());
                            if (phrase.max != null)
                            {
                                //range
                                var max = Int32.Parse(phrase.max.ToString());
                                if (tempC >= min && tempC <= max)
                                    choices.Add(phrase);
                            }
                            else
                            {
                                //only a minimum
                                if (tempC >= min)
                                    choices.Add(phrase);
                            }
                        }
                        else if (phrase.max != null)
                        {
                            //only a maximum
                            var max = Int32.Parse(phrase.max.ToString());
                            if (tempC <= max)
                                choices.Add(phrase);
                        }
                        else
                        {
                            choices.Add(phrase);
                        }

                    }

                    //next match on temp
                    if (phrase.min != null)
                    {
                        var min = Int32.Parse(phrase.min.ToString());
                        if (phrase.max != null)
                        {
                            //range
                            var max = Int32.Parse(phrase.max.ToString());
                            if (tempC >= min && tempC <= max)
                                if (!choices.Contains(phrase))
                                    choices.Add(phrase);
                        }
                        else
                        {
                            //only a minimum
                            if (tempC >= min)
                                if (!choices.Contains(phrase))
                                    choices.Add(phrase);
                        }
                    }
                    else if (phrase.max != null)
                    {
                        //only a maximum
                        var max = Int32.Parse(phrase.max.ToString());
                        if (tempC <= max)
                            if (!choices.Contains(phrase))
                                choices.Add(phrase);
                    }

                }

                //we have our choices...
                var choice = choices[Rand.Next(choices.Count)];
                result += choice.replacedle.ToString().Replace("|", " ") + "\n" + choice.subline.ToString();
                return new CommandResponse(result, parseMode: ParseMode.Markdown)
                {
                    //ImageUrl = c.icon_url,
                    //ImageDescription = choice.replacedle.ToString().Replace("|", " ") + "\n" + choice.subline.ToString(),
                    //Imagereplacedle = c.place
                };
            }
            return null;

        }