TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
paddy
NA
10
0
LINQ to Objects Question [SOLVED]
Sep 17 2008 2:30 AM
Hi there !
I have an object, built upon a XML schema and want to use LINQ to get the data out of it
which I'm interested in :)
The structure look like the following example :
SimulationStep [1..n]
- EnvironmentStep [1]
- Events [0..n]
- ResultingStateChanges [0..n]
- Objects [1]
- Object[0..n]
each "Object" (the last one in that class chain) has an attribute x, y and z, meaning the position of this object
in 3D space. Theres also an ID which is used to identify each object.
Now I want to collect all (x,y,z) triplets for each SimulationStep for the object which equals the given ID.
I already tried it this way :
for (int i = 0; i < stepCount; i++)
{
var events = from c in log.SimulationStep[i].EnvironmentSimulatorStep.EnvSimInputEvent
from d in c.ResultingStateChanges
from e in d.Agents.Agent
where e.id == id
select new { c.occurrenceTime, o = new Vector3((float)e.x, (float)e.y, (float)e.z) }
}
but all I get with this one, is the result (x,y,z) of SimulationStep 0. But I want a list with the positions
in each step. This way :
SimStep[0] - (0,0,0)
SimStep[1] - (5,0,0)
SimStep[2] - (10, 7, 0)
for example....
How to archieve that ? Many thanks in advance :)
bye and greetings :-)
paddy
Reply
Answers (
1
)
Execution plan saved for LINQ compiled queries?
finding foreign key references