I have the How to insert different queries on the same means the type that is typed in the variable, that means its type will be set at compile time, That's why an anonymous type will be assigned on your first use, in your second you are trying to provide it with a different anonymous type, you can not do this. You can modify your code to use a class instead of an anonymous object and then project it on it, then what you want to do now is to do it. You can create a class like this: and then project it by modifying your selection statement: var variable retl name which is equivalent to some queries. After some situations I want to make it identical with another query. But I get an error like
the built-in cast type "System.Collections.Generic.IEnumerable & lt; AnonymousType # 1 & gt;" In "System.Collections.Generic.IEnumerable" & lt; AnonymousType # 2 & gt; "Impossible" . You can ask me why I do not want to define another
var variable because it is used in a
foreach cycle Take a look at the code:
var retVal = from the resulting group item. AsEnumerable () where groupItem.SMS.First (). AmountOfParts == ((from the item in rawSmsList.AsEnumerable) Item.referenceNumber == groupItem.Sms.First (). Select the reference number item.) (Count) Select new {value = groupItem.Value, Sms = groupItem.Sms}; // Condition if (Retal ToArray ( ). Length == 0) { // Here I need a new query of retell quote retlal = as a result of the group item.f inkmemeble () where groupItem.SMS.First () .ZhoseAppeart == (from the items in RawSmsList.AsEnumerable ()) item.senderNumber = = GroupItem.Sms.First () Select Sender Number.) .net ()) Select new {value = groupItem.Value, Sms = groupItem.Sms};} Foreach (var item in retVal) / / FOREACH same Hopefully expect !!!
var variable? Or how to find the
var variable type and then insert it into a new defined variable?
Public class Mylux {public int value {get; Set;} public string sms {get; Set;}}
var retVal = ...... select new MyClass {Value = groupItem.Value, Sms = groupItem.Sms};
No comments:
Post a Comment