Hi All,
The compiler complains as follows:
“…There is no overloaded version of ‘First’ that can be called with these arguments”
but I can’t see what is wrong. I could not find an example of the proper use of the ‘First’ predicate anywhere.
I am trying to retrieve the first instance IDesignerProperty where ‘Name’ equals the test value.
{property Enum: IEnumerable<IDesignerProperty> read GetEnum;}
var LDProp: IDesignerProperty;
LDProp := ADictionary.Dict[LCtrl.QualifiedClassName].Properties.Enum.First(
function(AProp: IDesignerProperty): boolean
begin
Result := (AProp.Name = 'test');
end);
I submitted a bug about an error message like this. If it’s the same case, it’s extremely unhelpful.
I think you might find that you need to specifically add the < IDesignerProperty > part in your code, rather than try to have it type-inferred by the compiler.
ie .Enum<xyz>.First( );
If that’s it .. it’s a bit upsetting that we can’t always have nice things.
You should most definitely update to 2.0.1 - there have been a lot of improvements since v1 (and more coming). I use Spring4D a lot (I no longer use the rtl collections) including the container - once you have written an application using dependency injection it’s hard to go back to no using it.
FWIW, a predicate is typically just a function that returns a boolean value - it looks more complicated than it should be in delphi due to the lack of lambda style syntax.