fbpx

DYNAMIC Lists, and Anonymous Types

More
2 years 2 months ago #1 by Phil Hepburn
DYNAMIC Lists, and Anonymous Types was created by Phil Hepburn
Hi Robert, Team and guys,

I have acted on your recent code suggestions Robert and have come up with an improved version of my first tries with List<DYNAMIC>. See attached function.

So my next efforts, this morning, then went into trying to access the elements in my dynamic List. With the idea of grabbing one and then doing something with it, and its properties.

I have had some success, but only if I cast the collection items (elements) to type Object.

I have struggled in my usual way to get other things to work - BUT - get some messages back from the compiler that I don't understand - when it seems to me that the simple ToString() code should work.

Have you or anyone else on the Team got any ideas ?
TIA,



Cheers,
Phil.
Attachments:

Please Log in or Create an account to join the conversation.

More
2 years 2 months ago #2 by Robert van der Hulst
Replied by Robert van der Hulst on topic DYNAMIC Lists, and Anonymous Types
Phil,

You will have to include the Microsoft.CSharp assembly in the references list of your app.

Robert

XSharp Development Team
The Netherlands
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.

More
2 years 2 months ago #3 by Phil Hepburn
Replied by Phil Hepburn on topic DYNAMIC Lists, and Anonymous Types
Thanks Robert,

Thought it may be something easy ;-0)

Now all works as I would wish - can access the property values in each of the returned collection elements (or items).
See attached image test.

Best regards,
Phil.

P.S. X# eNotes on LINQ and related topics is going well - see second image of the contents of a large appendix added to my C# eNotes of 4.5 years back.
Attachments:

Please Log in or Create an account to join the conversation.