我有以下LInq声明:
public class TestClass<T> : Form where T: struct, IConvertible
{
private class MyObject
{
public byte Number {get; set;}
public string Name {get; set;}
}
private IReadonlyDictionary<string, T> myListA;
private List<MyObject> myListB;
public void Convert()
{
var query = (from a in myListA
join b in MyListB
on a.Value equals b.Number
select new
{
b.Name
}).ToList();
}
}
如何将a.Value
与b.Number
进行比较?
答案 0 :(得分:0)
致电ToByte
a.Value.ToByte(Thread.CurrentThread.CurrentCulture) == b.Number
或尝试
Convert.ToByte(a.Value) == b.Number