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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:32:40+00:00 2026-05-15T10:32:40+00:00

I am trying to use Delphi 2010’s TObjectDictionary generic. I would like to pass

  • 0

I am trying to use Delphi 2010’s TObjectDictionary generic.

I would like to pass an enumerator of the Values property of that generic class, and the compiler doesn’t seem to want to let me… Example:

  TAttributeStates = class(TInterfacedObject, IAttributeStates)
  private
    FStates: TObjectDictionary<TPatchAttribute, TAttributeState>;

  public

    constructor Create;
    destructor Destroy; override;

    function GetEnumerator: TObjectDictionary<TPatchAttribute, TAttributeState>.TValueEnumerator;

  end;

  implementation

    function TAttributeStates.GetEnumerator: TObjectDictionary<TPatchAttribute, TAttributeState>.TValueEnumerator;
    begin
      result := FStates.Values.GetEnumerator;
    end;

This fails to compile with the error:

[DCC Error] ChannelStates.pas(249): E2010 Incompatible types: 'TDictionary<Generics.Collections.TObjectDictionary<TKey,TValue>.TKey,Generics.Collections.TObjectDictionary<TKey,TValue>.TValue>.TValueEnumerator' and 'TDictionary<ChannelPatch.TPatchAttribute,ChannelStates.TAttributeState>.TValueEnumerator'

It seems that the compiler isn’t resolving the sub-type properly…

Anyone have any ideas?

N@

  • 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-15T10:32:41+00:00Added an answer on May 15, 2026 at 10:32 am

    Found it.

    function GetEnumerator: TEnumerator<TAttributeState>;
    
    
    function TAttributeStates.GetEnumerator: TEnumerator<TAttributeState>;
    begin
      result := FStates.Values.GetEnumerator;
    end;
    

    Works fine.

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

Sidebar

Related Questions

In Delphi XE, I'm trying to use GetForegroundWindow to detect the window that was
I'm trying to write a class in Delphi 2007 that uses a ActiveX library.
I'm using Delphi 9's TDictionary generic class. My TDictionary looks like this: g_FileHandlers :
I am trying to use Delphi 2009's refactoring to extract an interface from a
Trying to use GnuPG with Delphi (Win32). I need to sign some file with
I'm trying to use an API under Delphi. Here's the API documentation: OKERR ENTRY
I'm trying use self-signed certificate (c#): X509Certificate2 cert = new X509Certificate2( Server.MapPath(~/App_Data/myhost.pfx), pass); on
I am trying to migrate my own projects to delphi 2010. But it seems
Im trying to use a function from Windows API on delphi, functions for Windows
I've been trying to use tomazy's FutureWindows infrastructure (see his answer at Delphi GUI

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.