Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4018274
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:57:47+00:00 2026-05-20T09:57:47+00:00

I am using .net framework 3.5 framework & for database operations entity framework. So,

  • 0

I am using .net framework 3.5 framework & for database operations entity framework. So, to fetch the data i am using LINQ queries & returns a resultset in a list.
e.g

public class Emp
{
 public int CD{get;set;}
 public string Name{get;set;}
}


public List<Emp> GetServTypeForPromotionDue()
{
        return (from a in Context.TableName
                    select new Emp{ a.CD, a.NAME });

}

I am planning to migrate from 3.5 to 4.0. I have heard about dynamic keyword in .net 4.0. Can i make use of ‘dynamic’ keyword in order to remove the Class Emp & without creating Anonymous methods?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T09:57:48+00:00Added an answer on May 20, 2026 at 9:57 am

    You could use dynamic for this (e.g. returning List<dynamic>, and building an ExpandoObject in the select clause), but I wouldn’t recommend it. You’d lose compile-time type safety, Intellisense etc for little benefit. What do you believe you’d gain from using dynamic? Just removing a few lines of code?

    EDIT: Example of using dynamic:

    public List<dynamic> GetServTypeForPromotionDue()
    {
            return (from a in Context.TableName
                    select (dynamic) (new { a.CD, a.NAME })).ToList();
    }
    

    Or…

    public List<dynamic> GetServTypeForPromotionDue()
    {
            return (from a in Context.TableName
                    select (dynamic) (new ExpandoObject { a.CD, a.NAME })).ToList();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there an ASP.NET AJAX framework other than just using UpdatePanel & Friends or
I wonder if is possible to use FTS with LINQ using .NET Framework 3.5.
I am developing a Database File System . I am using - .Net framework
I use a SQLite database and Entity Framework (with .net framework 3.5). I'm trying
I'm using Entity Framework to access my MySQL database. The model was generated using
I am using .Net framework 2.0 / jQuery to make an Ajax call to
What is difference in developing applications using .Net Framework, Asp.net and developing application in
I am trying to leverage ORM given the following requirements: 1) Using .NET Framework
We have an application written in C#, using .NET Framework 3.0 or 3.5 or
Using the .net framework you have the option to create temporary files with Path.GetTempFileName();

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.