X# differes from C# ? - IEnumerable ?? Help ???

This forum is meant for questions and discussions about the X# language and tools
Post Reply
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

X# differes from C# ? - IEnumerable ?? Help ???

Post by Phil Hepburn »

Hi Robert and Team, and anyone else with knowledge,

I have a small (but interesting?) problem, while converting work C# app code to X#. So far everything has translated as I thought it should / would. Until now when I come to 'IEnumerable'.

Both C# and X# apps are targeted at the .NET 4.5.2 but the C# code allows me to use a 'Type' free form of IEnumerable, whereas the X# code gives me an error unless I use the Typed form.

I include image detail so you can see what I meant. Can you explain to me WHY ? anybody ?

Also, there is the image with the X# interesting way out for me - the use of 'local implied' - works a treat. Can anyone explain PLEASE ?!
TypeT_IEnum_01.jpg
TypeT_IEnum_01.jpg (53.83 KiB) Viewed 273 times
TypeT_IEnum_02.jpg
TypeT_IEnum_02.jpg (62.4 KiB) Viewed 273 times
TypeT_IEnum_03.jpg
TypeT_IEnum_03.jpg (13.56 KiB) Viewed 273 times
TypeT_IEnum_04.jpg
TypeT_IEnum_04.jpg (37.85 KiB) Viewed 273 times
TypeT_IEnum_05.jpg
TypeT_IEnum_05.jpg (86.46 KiB) Viewed 273 times
TypeT_IEnum_06.jpg
TypeT_IEnum_06.jpg (83.72 KiB) Viewed 273 times
I hope you understand my problem from the image detail supplied.
TIA,
and Regards,
Phil.
Wales, UK.
User avatar
Chris
Posts: 4898
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

X# differes from C# ? - IEnumerable ?? Help ???

Post by Chris »

Hi Phil,

My guess is that you are using in your code a USING System.Collections.Generic and not a USING System.Collections, so the compiler tries to use the generic version of IEnumerable. But without seeing the complete prg file, this is only a guess.

Chris
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

X# differes from C# ? - IEnumerable ?? Help ???

Post by Phil Hepburn »

Hi Chris,

You are 'spot on' !

What a clever man you are ;-0)

This is the result of chopping up code, cut and paste, drag and copy, and all that sort of thing to make life easier. From one open instance of VS to another.

Still, we live and learn - I try to learn at least one new thing each day - this is a good start !!!

And 'local implied' did get me out of a hole when I did not know what else to do ;-0)

Now then ... upwards and onwards >>>
Cheers,
Phil.
Wales, UK.
Post Reply