私は次のXMLを持っており、特定の統計を通過するときにYearとReturn_Valueを抽出するクエリが必要です。linq xmlステートメントで2つのwhere節を持つ方法
ディクショナリオブジェクトの1つのadd文で2つのwhere節を持つことができないため、現在のコードは機能しません。これには解決策がありますか?
foreach (var row in rows)
{
myHoldingsDistribution.Add(row.Descendants()
.Where(y => y.Name.LocalName == keyName)
.Select(q => q.Value).Max(),
Double.Parse(row.Descendants().Where(y => y.Name.LocalName == valueName)
.Select(q => q.Value).Max()) * multiplier);
<Table>
<Year>1</Year>
<Statistic>0 Percentile</Statistic>
<Return_Value>0.0535644000000</Return_Value>
</Table>
base {System.Xml.Linq.XContainer}: <Table>
<ALMRunResults_Year>1</ALMRunResults_Year>
<Statistic>0 Percentile</Statistic>
<Return_Value>0.0535644000000</Return_Value>
</Table>
FirstAttribute: null
HasAttributes: false
HasElements: true
IsEmpty: false
LastAttribute: null
Name: {Table}
NodeType: Element
Value: "10 Percentile0.0535644000000"
編集
次の文で - 私は、理想的には1パーセンタイルでないものをフィルタリングするために二回.whereたいと思います。
myHoldingsDistribution.Add(row.Descendants()
.Where(y => y.Name.LocalName == keyName)
.Select(q => q.Value).Max(),
Double.Parse(row.Descendants().Where(y => y.Name.LocalName == valueName)
.Select(q => q.Value).Max()) * multiplier);
「どこに2つの句を入れることはできませんか?あなたが提供したコードからどんなエラーが出ていますか? – StriplingWarrior
"私は理想的には、1パーセンタイルではないものをフィルタリングするために2回。 - 何を止めているの?あなたは通常、.Where文を連鎖させるだけです: 'rows.Where(...)。Where(...)'これを試してみるとどうなりますか、コードはどのように見えますか? – StriplingWarrior