score:0

I tried this:

using System;
using System.Linq;
using System.Linq.Dynamic;
using System.Collections.Generic;

namespace ConsoleApplication1
{
    public class Customer
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string Tags { get; set; }
    }


    class Program
    {
        static void Main( string[] args )
        {

            var Customers = new List<Customer>(){ new Customer(){ FirstName = "test", LastName = "case"}};

            var query2 = Customers.Select(
                    cust => new Customer
                    {
                        FirstName = cust.FirstName,
                        LastName = cust.LastName,
                        Tags="sampleTag,Tag"
                    }
                ).ToList<Customer>();


            var query1 = Customers.AsQueryable().Select( "new (FirstName, LastName, \"sampleTag,Tag\" AS Tags)" );

            foreach(dynamic cust in query1)
            {
                Console.WriteLine(cust.Tags);
            }

            Console.ReadLine();
        }
    }
}

Related Articles