score:3
Accepted answer
// given trend data has a single measurement referencing a single site.
var gaugedata = db.trend_data
.where(x => x.trend_data_time >= sdate
&& x.trend_data_time <= edate
&& x.measurement.site.site_name == insite))
.select(x => new
{
x.measurement.site.site_name,
x.trend_data_time,
x.trend_data_avg
}).tolist()
.select( x=> new gaugedata
{
siteid = site_name,
data_time = trend_data_time,
trend_data = convert.tosingle(trend_data_avg)
}).tolist();
score:0
trend_data = convert.tosingle(rainfall.trend_data_avg)
Source: stackoverflow.com
Related Query
- How to convert linq results to HashSet or HashedSet
- How do I convert from a Dictionary to a SortedDictionary using LINQ in C#?
- how to convert sql union to linq
- How to convert LINQ query result to List?
- How can I convert Linq results to DTO class object without iteration
- How to Convert LINQ Comprehension Query Syntax to Method Syntax using Lambda
- How to Convert Row to Column in Linq and SQL
- How do I convert Foreach statement into linq expression?
- How can I convert DateTime to String in Linq Query?
- How to convert between Linq expressions with different return types?
- How can I convert this SQL Query into LINQ (OVER (PARTITION BY Date))
- How do I convert IEnumerable to Collection with linq
- Linq - How to convert from flat to hierarchical?
- How to convert Anonymous Type to Strong Type from LINQ query
- How to convert list of objects with two fields to array with one of them using LINQ
- How to convert an array to a dictionary using LINQ
- How to Convert Anonymous Type to List <dynamic> using Linq to SQL in C#
- How to convert Linq array[] to int[]?
- How to convert this Linq query syntax to method syntax?
- How convert result of linq query to List(Of T)
- How to convert this foreach loop into Linq code?
- How can i convert Linq var to List
- How to convert foreach loop to a Linq query?
- How to use ToString() method to convert an integer to string inside LINQ
- How to Convert a LINQ result to DATATABLE?
- How convert sql with count to linq
- How convert IQueryable<IQueryable<Page>> to IQueryable<Page> with Linq
- how to convert int to string in Linq to entities
- How do I convert this SQL query to LINQ to SQL
- How to convert this linq query to lambda?
More Query from same tag
- How to Set Custom DataGridView Headers (with spaces) using LINQ?
- how i can show object in gridview or in any usful contro
- ASP MVC Lambda Expressions or Query Extensions?
- Linq to SQL not querying memory
- Connect to Database with Connection String to use LINQ
- Compare lists and return objects that doesn't exist
- Grouping in Elastic Search
- find numeric Approximation with Linq when comparing single item to many items in a Collection
- Does 'And' vs 'AndAlso' matter with linq in vb.net?
- DefaultIfEmpty is ignored
- Update Rows in the database with LINQ
- Read the start, end points from table and write value into text file based on those points
- How can this be achieved in LINQ?
- C# Select View from Oracle DB with LINQ
- How to export data to Excel using ASP.NET MVC 5 without reloading the page?
- associated data in linq select
- Row_number over (Partition by yyy) in Linq?
- What is Guid.NewGuid() doing in LINQ to Entities?
- LINQ: Can't filtering List<Model> data by .Contains
- Linq To Entities, Select multiple sets of data with one query
- What is appropriate Linq Query for my tables?
- What is the C# equivalance of the Aggregate keyword in VB Linq?
- How to write Linq Queries for CRUD operations using Entity Framework with Asp.Net?
- LINQ Contains Match Exactly
- How to search multiple folders for Files with a certain substring in Filename using c#?
- Add Grouping to LINQ Query
- LINQ nested groups performance
- Linq query averages
- query never returning results - "Enumeration yielded no results"
- Dynamic Order (SQL ORDERBY) in LINQ CompiledQuery