Linq – possible bug

Home Forums kbmMW Linq – possible bug

  • This topic has 1 reply, 2 voices, and was last updated 8 months ago by kimbomadsen.
Viewing 1 reply thread
  • Author
    • #54112


      Just started to use linq and it’s really cool πŸ™‚ However when I use an empty TObjectlist I do get an error after this code:

      lq := Linq.Using(FSomeList).Shared;

      The error I get is:

      Unexpected type: (TObjectList<SomeUnit.TSomeObject> @04274640)

      Is this intention? I expected it to work althought it doesn’t make much sense to use an empty list.

      Thanks in advance!


    • #54113

      It is only partly the intention πŸ™‚

      Say if you have a non generic but enumerable list or array, like a TObjectList, then it will attempt to locate the type based on the first item in the list. Since that item does not exist (list is empty), it will not know what subtype that is used, and will thus in that case throw that exception.

      However when using generic enumerable lists, the correct response will be to still figure out the subtype, and in this case there should not be an exception.

      I have fixed that scenario for the next release.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.