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 7523519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:49:38+00:00 2026-05-30T02:49:38+00:00

I am trying to create a generic typed class, but am running into a

  • 0

I am trying to create a generic typed class, but am running into a problem. Here is my basic class definition:

public class QueueObject<T> where T : System.ServiceModel.DomainServices.Client.Entity
{
    public string LoadingMessage { get; set; }
    public System.ServiceModel.DomainServices.Client.EntityQuery<T> Query { get; set; }
}

I am trying to add instances of this class to a queue

private Queue<QueueObject<Entity>> _queue;
this._queue.Enqueue(new QueueObject<MyEntity> {Query = MyContext.GetMyEntitiesQuery(), LoadingMessage = "Loading some stuff"});

This doesn’t work. I get an error saying that QueueObject cannont be converted to QueueObject. I don’t understand because MyEntity inherits from Entity. Am I doing something wrong?

Here is the same code in VB if it helps:

Public Class QueueObject(Of T As System.ServiceModel.DomainServices.Client.Entity)
    Public Property LoadingMessage As String
    Public Property Query As System.ServiceModel.DomainServices.Client.EntityQuery(Of T)
End Class

Private _queue As Queue(QueueObject(Of Entity))
Me._queue.Enqueue(New QueueObject(Of MyEntity) With {.Query = MyContext.GetMyEntitiesQuery(), .LoadingMessage = "Loading some stuff..."})
  • 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-30T02:49:39+00:00Added an answer on May 30, 2026 at 2:49 am

    Still not sure about the reason for the original error, but a possible solution was to make each entity implement an interface. Then make the QueueObject be of this interface type.

    I ended up going another route so this ended up being irrelevant.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've run into a problem while trying to create a generic ArrayAdapter. It probably
I'm trying to create an instance of a generic class using a Type object.
I'm trying to create a generic class in PHP that will provide a way
I am trying to create a generic class which new's up an instance of
I'm trying to create a generic class which will have some static functions based
I'm trying to write a class that has a generic member variable but is
I'm trying to create my own class template for Visual Studio called Public Class.
I'm trying to create a UserControl that inherits from a generic class. It does
Using C++, I'm trying to create a generic container class to handle multiple data
I am trying to create a very simple CUser class in my project, but

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.