If you simply want to make a MyModel2 copy of each MyModel1 some point afterwards, then it's simple: var OutputModel2 = OutputModel1. Select(m => new MyModel2 { ModelId = m. ModelId, Var2 = m.
Var2, }).ToList() If you need to query the data context for those MyModel2 objects with the same ids as the MyModel1 objects (i.e. , there is a relation), then it's different (but you should provide that information) PS: There's no need to write as List.
If you simply want to make a MyModel2 copy of each MyModel1 some point afterwards, then it's simple: var OutputModel2 = OutputModel1. Select(m => new MyModel2 { ModelId = m. ModelId, Var2 = m.
Var2, }).ToList(); If you need to query the data context for those MyModel2 objects with the same ids as the MyModel1 objects (i.e. , there is a relation), then it's different (but you should provide that information). PS: There's no need to write as List -- the return value of ToList is exactly a List, no more, no less.
You may have to attach it to the data context or something to enable tracking. – Slappy Mar 31 at 3:03 @Slappy: Depends on what MyModel2 is exactly. The question doesn't say.
– Jon Mar 31 at 3:05 yeah, I just say cause he mentioned MyDataContext in the question – Slappy Mar 31 at 3:36.
Var OutputModel2 = (from m in MyDataContext. Model2Collection where MyDataContext. Model1Collection.
Any(x => x. ModelID == m. ModelID && x.
Var2 == 3/*PUT YOUR WHERE CLAUSE HERE*/)).ToList().
Assuming that you're looking for a subset of existing Model2's, you could use something like the following: var OutputModel2 = from t2 in CollectionOfModel2s join t1 in OutputModel1 on t2. ModelID equals t1. ModelID select t2; The "join" functions like an inner join in SQL, and won't return any t2's that don't have a match.
There's a fairly detailed description of joins and whatnot at: msdn.microsoft.com/en-us/library/bb39794....
Type ParametersTSourceThe type of the elements of source. IEnumerableThe IEnumerable to create a List from. Return ValueType: System.Collections.Generic.
ListA List that contains elements from the input sequence. Usage NoteIn Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable. When you use instance method syntax to call this method, omit the first parameter.
For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.