Here are the examples of the csharp api System.Collections.Generic.IDictionary.ContainsKey(double) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
5 Examples
19
Source : DoubleUtil.cs
with GNU Lesser General Public License v3.0
from czsgeo
with GNU Lesser General Public License v3.0
from czsgeo
static public List<double> GetKeysOfGrossError(IDictionary<double, double> data, double errorTimes = 3, int order = 2, bool isLoop = false)
{
var list = new List<double>();
var nearty = GetNeatlyData(data, errorTimes,order, isLoop);
return data.Keys.Where(m => !nearty.Keys.Contains(m)).ToList();
foreach (var item in data)
{
if (!nearty.ContainsKey(item.Key)) { list.Add(item.Key); }
}
return list;
}
19
Source : NeteaseMusicApi.cs
with GNU General Public License v3.0
from Executor-Cheng
with GNU General Public License v3.0
from Executor-Cheng
public void AppendLrc(string lrcText)
{
string[] array = lrcText.Split(new string[2]
{
"\r\n",
"\n"
}, StringSplitOptions.RemoveEmptyEntries);
foreach (string text in array)
{
if (text.StartsWith("[ti:"))
{
replacedle = SplitInfo(text);
}
else if (text.StartsWith("[ar:"))
{
Artist = SplitInfo(text);
}
else if (text.StartsWith("[al:"))
{
Album = SplitInfo(text);
}
else if (text.StartsWith("[by:"))
{
LrcBy = SplitInfo(text);
}
else if (text.StartsWith("[offset:"))
{
Offset = int.Parse(SplitInfo(text));
}
else
{
try
{
string value = new Regex(".*\\](.*)").Match(text).Groups[1].Value;
if (!(value.Replace(" ", "") == ""))
{
foreach (Match item in new Regex("\\[([0-9.:]*)\\]", RegexOptions.Compiled).Matches(text))
{
double totalSeconds = TimeSpan.Parse("00:" + item.Groups[1].Value).TotalSeconds + Offset / 1000;
if (LrcWord.ContainsKey(totalSeconds))
{
LrcWord[totalSeconds] += $"({value})";
}
else
{
LrcWord[totalSeconds] = value;
}
}
}
}
catch
{
}
}
}
}
19
Source : CryptoOrderBook.cs
with Apache License 2.0
from Marfusios
with Apache License 2.0
from Marfusios
private void InsertLevelIntoPriceGroup(OrderBookLevel level, IDictionary<double, OrderedDictionary> collection,
OrderBookLevelsOrderPerPrice orderingGroup, double? previousPrice = null, double? previousAmount = null)
{
// remove from last location if needed (price updated)
if (previousPrice.HasValue && !CryptoMathUtils.IsSame(previousPrice, level.Price) && collection.ContainsKey(previousPrice.Value))
{
var previousPriceVal = previousPrice.Value;
var previousGroup = collection[previousPriceVal];
previousGroup.Remove(level.Id);
if (previousGroup.Count <= 0)
{
collection.Remove(previousPriceVal);
orderingGroup.Remove(previousPriceVal);
}
level.PriceUpdatedCount++;
}
// ReSharper disable once PossibleInvalidOperationException
var price = level.Price.Value;
if (!orderingGroup.ContainsKey(price))
orderingGroup[price] = 0;
if (!collection.ContainsKey(price))
{
collection[price] = new OrderedDictionary(_priceLevelInitialCapacity) {{level.Id, level}};
return;
}
var currentGroup = collection[price];
var ordering = orderingGroup[price] + 1;
orderingGroup[price] = ordering;
// we wanna put order at the end of queue
if (previousPrice.HasValue)
{
currentGroup.Remove(level.Id);
}
// amount changed, increase counter
if (previousAmount.HasValue && !CryptoMathUtils.IsSame(previousAmount, level.Amount))
{
level.AmountUpdatedCount++;
}
currentGroup[level.Id] = level;
level.Ordering = ordering;
}
19
Source : CryptoOrderBook.cs
with Apache License 2.0
from Marfusios
with Apache License 2.0
from Marfusios
private void InsertLevelIntoPriceGroup(OrderBookLevel level, IDictionary<double, OrderedDictionary> collection,
OrderBookLevelsOrderPerPrice orderingGroup, double? previousPrice = null, double? previousAmount = null)
{
// remove from last location if needed (price updated)
if (previousPrice.HasValue && !CryptoMathUtils.IsSame(previousPrice, level.Price) && collection.ContainsKey(previousPrice.Value))
{
var previousPriceVal = previousPrice.Value;
var previousGroup = collection[previousPriceVal];
previousGroup.Remove(level.Id);
if (previousGroup.Count <= 0)
{
collection.Remove(previousPriceVal);
orderingGroup.Remove(previousPriceVal);
}
level.PriceUpdatedCount++;
}
// ReSharper disable once PossibleInvalidOperationException
var price = level.Price.Value;
if (!orderingGroup.ContainsKey(price))
orderingGroup[price] = 0;
if (!collection.ContainsKey(price))
{
collection[price] = new OrderedDictionary(_priceLevelInitialCapacity) {{level.Id, level}};
return;
}
var currentGroup = collection[price];
var ordering = orderingGroup[price] + 1;
orderingGroup[price] = ordering;
// we wanna put order at the end of queue
if (previousPrice.HasValue)
{
currentGroup.Remove(level.Id);
}
// amount changed, increase counter
if (previousAmount.HasValue && !CryptoMathUtils.IsSame(previousAmount, level.Amount))
{
level.AmountUpdatedCount++;
}
currentGroup[level.Id] = level;
level.Ordering = ordering;
}
19
Source : SliderTick.cs
with MIT License
from Phenek
with MIT License
from Phenek
private void GenerateTickList()
{
ColumnDefinitions.Clear();
var index = 0;
foreach (var tick in ItemsSource)
{
ColumnDefinitions.Add(new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)});
ColumnDefinitions.Add(new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)});
var dash = new BoxView
{
HeightRequest = 4,
WidthRequest = 2,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Start
};
var label = new Label
{
Text = tick.Value,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.End
};
dash.SetBinding(BackgroundColorProperty,
new Binding(nameof(TickColor)) {Source = this, Mode = BindingMode.OneWay});
label.SetBinding(Label.TextColorProperty,
new Binding(nameof(LabelColor)) {Source = this, Mode = BindingMode.OneWay});
label.SetBinding(Label.FontSizeProperty,
new Binding(nameof(FontSize)) {Source = this, Mode = BindingMode.OneWay});
label.SetBinding(Label.FontFamilyProperty,
new Binding(nameof(FontFamily)) {Source = this, Mode = BindingMode.OneWay});
label.SetBinding(Label.FontAttributesProperty,
new Binding(nameof(FontAttributes)) {Source = this, Mode = BindingMode.OneWay});
SetRow(dash, 1);
SetRow(label, 2);
SetColumn(dash, index);
SetColumn(label, index);
SetColumnSpan(dash, 2);
SetColumnSpan(label, 2);
Children.Add(dash);
Children.Add(label);
index += 2;
}
SetColumn(_slider, 1);
SetColumnSpan(_slider, ColumnDefinitions.Count - 2);
if (ItemsSource.ContainsKey(Value))
{
var array = ItemsSource.Keys.ToArray();
var indexVal = Array.IndexOf(array, Value);
double nbTicks = ItemsSource.Count - 1;
var aTick = 1 / nbTicks;
_slider.Value = indexVal * aTick;
}
}