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

  • Home
  • SEARCH
  • 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 5959183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:38:57+00:00 2026-05-22T18:38:57+00:00

It seems like the most simplistic things are hard to figure out sometimes… Many

  • 0

It seems like the most simplistic things are hard to figure out sometimes…
Many code references have the type TEntity used for generic handling of entities in an entity data model. I tried to use it in my code and get: “Unknown type ‘TEntity'” what gives??? Why do I get “Unknown type”? Is this only available in .net 4.0?

BTW: Using .net 3.5.

I’m trying to use code from this book:

public TEntity ExecuteFirstorDefault<TEntity>(ObjectQuery<TEntity> objectQuery)
  {
    try
    {
      return objectQuery.FirstOrDefault();
    }
    catch (EntitySqlException ex)
    {
      throw ex; //TODO: Replace with handling code
      //additional exceptions as described in Chapter 18
    }
  }
  • 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-22T18:38:58+00:00Added an answer on May 22, 2026 at 6:38 pm

    TEntity is a generic type parameter, not a concrete type.


    I guess my question is why I can’t use it, why do I get Unknown type.

    Because it’s not a concrete type.

    Say you have a generic list implementation, declared as List<T>. T is a type parameter, which means that it does not represent a specific type. As the programmer, you have to instruct the compiler to use a specific type to use, rather than the generic type T, by providing a type argument. You could create a list of integers like so:

    List<int> myInts = new List<int>();
    

    In this example, the type argument is int. All the generic methods (or properties) of List that accept or return a T will instead use int.

    Further reading

    • An Introduction to C# Generics
    • Generics (C# Programming Guide)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to try my hand at some Chrome Extension Development. The most I
I've been interested in different chess engines lately. There are many open and closed
Are there any libraries out there that provide some limited functionality for primitive shapes.
I tried to search forum topics to find a tutorial that will guide me
consider the following test class: [TestClass] public class ExampleTests { [TestMethod] public void FileDoesNotExists()
i am using the rails 3 UJS for my forms. In one of the
We're trying to run a set of administrative tasks on the server via a
ok, this has been addressed by everybody, but yet I feel no closer to
So I got a problem that I can't wrap my mind around. I'm creating

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.