Freelance Project Requests Software Development in C# WPF Asp.Net Core Vba Excel Word SQL-Server EF Linq, UWP Net

Linq: Output to a variable list


How to pass the query results of a Linq query to a free list?


Solution: with list and elements of type Object

List<Object> dataList = query.ToList<Object>();





Complete C #, Linq code

// GET: /api/index

 public async Task<List<Object>> Index()


     //-------------< Index >------------- 

     //< get UserClaim Info >

     //*get User from Token

     var userClaim_in_Token = HttpContext.User.Claims.Where(c => c.Type == ClaimsIdentity.DefaultNameClaimType).FirstOrDefault(); //User as Name

     if (userClaim_in_Token == null)


         return null;


     string sEmail = userClaim_in_Token.Value;

     //</ get UserClaim Info >


     //< check user >

     long IDCurrent_User = await Get_UserID(sEmail);

     if (IDCurrent_User == 0) { return null; }

     //</ check user >



     //--< Get Linq.Query >--

     var query = (from searchAgent in _dbContext.tbl_SearchAgents

                  join users in _dbContext.tbl_Users on searchAgent.IDOwner equals users.IDUser into searchagents_with_user


                  from q2 in searchagents_with_user.DefaultIfEmpty()

                  join asp in _dbContext.Users on q2.IDAspNetUser equals asp.Id into searchagents_with_user_emails


                  from q3 in searchagents_with_user_emails.DefaultIfEmpty()


                  orderby searchAgent.IDOwner descending, searchAgent.IDSearchAgent  descending

                  select new { searchAgent.IDSearchAgent, q3.Email, searchAgent.Text_Search }).Take(3000);

     //--</ Get Linq.Query >--



     //----< fill Data_to_View >----

     List<Object> dataList = query.ToList<Object>();



     //< out >

     //*output to client

     return dataList;

     //</ out >

     //-------------</ Index >------------- 




Linq: Output to a variable list
Linq: Select Fields in Query
the type or namespace name dbAppData_Context does not exist
Delete record in Linq
Code snippet: Create Linq Select table from ID number fields
EF: Determine new ID of a data record
Asp MVC: Output Data from SQL Server directly to a List Type
Linq: Query data with a left join
Asp Linq: Collect data with a LINQ query from SQL Server


Contact for Jobs, Project Requests: