Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Implicitily Convert Error

$
0
0

Seem to be having a problem trying to set a class to my linq variable:

Here's the class for manipulating data from the database:

publicclassResult{public bool LongerThan10Seconds{ get;set;}publicintId{ get;set;}publicDateTimeCompletionTime{ get;set;}publicdouble longitude { get;set;}publicdouble latitude { get;set;}}

Then I use this LINQ Statement in regards to getting data from the specific database:

foreach(var query in data.AssetStatusHistories.Where(x => x.TimeStamp<= ft).Where(x => x.AssetID== guid)){if(lastResult !=null){if((query.TimeStamp- lastResult.CompletionTime).TotalSeconds>10){
            dataResults.Add(newResult(){Id= query.ID,
                                           longitude = query.Longitude,
                                           latitude = query.Latitude});}lastResult = query;// <-- Error Is Here}}

The Error being lastResult = Query, I keep getting the Cannot Implicitly Convert "Project.Data" to "Project.Result" does anyone have any recommended solutions? though it does seem I am not able to do this with one being a LINQ Object

I've seen a few in regards to this error but not specifically to LINQ.


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>