EDN Admin
Well-known member
I have a linq-to-objects query against an IEnumerable<XElement> and List<CustomObject> where Id like to do a composite key join that looks like this:
<div style="color:Black;background-color:White; <pre>
XDocument responseDocument = XDocument.Parse(_Response);
<span style="color:Blue; var results = <span style="color:Blue; from responseElement <span style="color:Blue; in responseDocument.XPathSelectElements(<span style="color:#A31515; "//response/operation/result")
<span style="color:Blue; let controlIdElement = responseElement.Element(<span style="color:#A31515; "controlid")
<span style="color:Blue; let controlId = controlIdElement.Value
<span style="color:Blue; let functionElement = responseElement.Element(<span style="color:#A31515; "function")
<span style="color:Blue; let function = functionElement.Value
<span style="color:Blue; join result <span style="color:Blue; in _Results
<span style="color:Blue; on <span style="color:Blue; new { controlId, function } <span style="color:Blue; equals <span style="color:Blue; new { result.ControlId, result.FunctionName }
<span style="color:Blue; select <span style="color:Blue; new
{
Result = result,
ResultElement = responseElement
};
[/code]
However, Im getting an error that Argument type {controlId:string, function:string} is not assignable to parameter key TKey.
Any ideas as to what Im doing wrong?
View the full article
<div style="color:Black;background-color:White; <pre>
XDocument responseDocument = XDocument.Parse(_Response);
<span style="color:Blue; var results = <span style="color:Blue; from responseElement <span style="color:Blue; in responseDocument.XPathSelectElements(<span style="color:#A31515; "//response/operation/result")
<span style="color:Blue; let controlIdElement = responseElement.Element(<span style="color:#A31515; "controlid")
<span style="color:Blue; let controlId = controlIdElement.Value
<span style="color:Blue; let functionElement = responseElement.Element(<span style="color:#A31515; "function")
<span style="color:Blue; let function = functionElement.Value
<span style="color:Blue; join result <span style="color:Blue; in _Results
<span style="color:Blue; on <span style="color:Blue; new { controlId, function } <span style="color:Blue; equals <span style="color:Blue; new { result.ControlId, result.FunctionName }
<span style="color:Blue; select <span style="color:Blue; new
{
Result = result,
ResultElement = responseElement
};
[/code]
However, Im getting an error that Argument type {controlId:string, function:string} is not assignable to parameter key TKey.
Any ideas as to what Im doing wrong?
View the full article