_
id name value
1 name 1
2 name 2
3 name2 NaN
4 name2 NaN
5 name3 10
var NonValueArray = new Dictionary<string, double>();
for (int i = 0, cnt = c.Count; i < cnt; i++)
{
logger.Trace(c[i].id + " " + c[i].value + " " + c[i].server);
if (Double.IsNaN((c[i].value)))
{
NonValueArray.Add(c[i].service, c[i].id);
}
}
foreach (var pair in NonValueArray)
{
Console.WriteLine(pair.Key + " = " + pair.Value);
}
Элемент с тем же ключом уже был добавлен.
var NonValueArray = new Dictionary<string, double>();
for (int i = 0, cnt = c.Count; i < cnt; i++)
{
logger.Trace(c[i].id + " " + c[i].value + " " + c[i].server);
if (Double.IsNaN((c[i].value)))
{
//NonValueArray.Add(c[i].service, c[i].id);
NonValueArray[c[i].service] = c[i].id;
}
}
foreach (var pair in NonValueArray)
{
Console.WriteLine(pair.Key);
}
public class Id: UInt32{}
public class Name: string{}
public class Value: double{}
public class IdNameValue
{
public Id id{get;set;}
public Name name {get; set;}
public Value value {get; set;}
}
IEnumerable<IdNameValue> idNameValues = Create();
var idNameValuesWhereValueIsNaN = idNameValues.Where(item=>double.IsNaN(item.value));