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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:20:06+00:00 2026-05-29T05:20:06+00:00

I have a large Quad Tree structure, made from generic lists ( List<T> )

  • 0

I have a large Quad Tree structure, made from generic lists (List<T>) pointing to more lists and so on. These lists are contained in a class: TreeNode<T>

In one such tree I store objects of type GameObject.

In order to make tree updates faster, I want to store a pointer / reference to the containing TreeNode on each GameObject, however… I’m coming across issues caused by the generic type <T> of the TreeNode.

Here is where I have the issue (inside the TreeNode class):

contents.Add(typedObject);
if (typedObject is GameObject)
{
    GameObject gameObject = (GameObject) (object) typedObject;
    gameObject.treeNode = this;
}

I get the error:

Cannot implicitly convert type 'TreeNode<T>' to 'TreeNode<GameObject>'

Any help or suggestions would be greatly appreciated. Thanks.

Edit –>
The node is stored on the GameObject as follows:

public TreeNode<GameObject> treeNode;
  • 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-29T05:20:07+00:00Added an answer on May 29, 2026 at 5:20 am

    If you don’t know the type of the TreeNode<T> i would suggest to create a non-generic base class. Then you can simply store the reference in the GameObject.

    Casting

    I would avoid it but you can cast the TreeNode<T> to TreeNode<GameObject> by using the operator as as follows:

    gameObject.treeNode = this as TreeNode<GameObject>;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large tree of Java Objects in my Desktop Application and am
I have large amounts of data (a few terabytes) and accumulating... They are contained
I have large list of the drop-down menu. Some of the option have very
I have large data sets (10 Hz data, so 864k points per 24 Hours)
I have large batches of XHTML files that are manually updated. During the review
I have large images displayed in a grouped tableview. I would like the images
I have large database table, approximately 5GB, now I wan to getCurrentSnapshot of Database
In my application I have large area (≈5000x5000pts) and I must allow user to
I'm developing a website in PHP and I have large JS files that I
I'm trying to create a faster query, right now i have large databases. My

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.