Passing a reference to TObjectDictionary <TKey, TValue> .TValueEnumerator
I am trying to use a generic Delphi 2010 TObjectDictionary file.
I would like to pass the property enumerator of Valuesthis generic class, and the compiler doesn't seem to want 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 does not compile with an 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 does not resolve the subtype correctly ...
Does anyone have any ideas?
N @
+3