VB -> C# System.Linq.Expression needs special treatment
Using 6.8.0
First a difficult one -- LINQ. Converting a string compare to
String.Compare(a,b,true) == 0
is rejected by LINQ and is wrong since the case sensitivity of LINQ is a function of the database, not the VB program. Unfortunately, you don't necessarily know it's a LINQ to SQL expression so it's not clear what is right. Perhaps an option or a flag?
I had an expression
req.devID.Split("/"c)(0)
the (0) was not converted to [0] as it should've been. I'll change the source to .First() to avoid this.
RIght now I put the conversion on hold as I try to clean up async-- VB is far more lenient and the legacy code hasn't been fully converted though it works. Not much you can do about that.
Thanks for raising this. It is indeed a tricky area.
I'd be interested to see more of the details of VB's async leniency. Sometimes these things can be "fixed" during conversion to choose some c# that does what the vb compiler would have done.
First, thanks for all your effort.
Converting old code to async can be messy so I don’t have any particular advice. It’s just the C# will complain about things like not having awaits and null exists whereas VB is lenient. I just need to clean up the code.
oh, one I forgot to mention – case sensitivity in converting imports to using. Another messy problem since you can’t know the case of the external reference by looking at the code locally. The more one is adept at the nuance of each language the more difficult it is to convert out of context. In other code (based on VB6 from 1990’s and converted to VB.Net and evolved) lots of implicit assumptions about modules dating to when it was a stand-alone COM module.
Finally it would be help to have an undo. To be prudent I do this manually and have to convert CSPROJ reference back to VBPROJ so it’s not a crisis – just a convenience.
Bob Frankston
https://Frankston.com https://Frankston.com
From: GrahamTheCoder [email protected] Sent: Tuesday, May 28, 2019 03:48 To: icsharpcode/CodeConverter [email protected] Cc: Bob Frankston [email protected]; Author [email protected] Subject: Re: [icsharpcode/CodeConverter] VB -> C# LINQ Etc. (#316)
Thanks for raising this. It is indeed a tricky area.
I'd be interested to see more of the details of VB's async leniency. Sometimes these things can be "fixed" during conversion to choose some c# that does what the vb compiler would have done.
— You are receiving this because you authored the thread. Reply to this email directly, https://github.com/icsharpcode/CodeConverter/issues/316?email_source=notifications&email_token=ABJ4OND4NWUQEOKATYU7AETPXTPTJA5CNFSM4HP57NEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWLIPAY#issuecomment-496404355 view it on GitHub, or https://github.com/notifications/unsubscribe-auth/ABJ4ONC7DM6FJXTBXED7WIDPXTPTJANCNFSM4HP57NEA mute the thread. https://github.com/notifications/beacon/ABJ4ONG62ZLRSA3O7R4EIQDPXTPTJA5CNFSM4HP57NEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWLIPAY.gif
One quick thought on LINQ – a #pragma – like declaration globally or at the query. This can be a way to add knowledge.
Bob Frankston
https://Frankston.com https://Frankston.com
From: Bob Frankston [email protected] Sent: Tuesday, May 28, 2019 07:16 To: 'icsharpcode/CodeConverter' [email protected]; 'icsharpcode/CodeConverter' [email protected] Cc: 'Bob Frankston' [email protected]; 'Author' [email protected] Subject: RE: [icsharpcode/CodeConverter] VB -> C# LINQ Etc. (#316)
First, thanks for all your effort.
Converting old code to async can be messy so I don’t have any particular advice. It’s just the C# will complain about things like not having awaits and null exists whereas VB is lenient. I just need to clean up the code.
oh, one I forgot to mention – case sensitivity in converting imports to using. Another messy problem since you can’t know the case of the external reference by looking at the code locally. The more one is adept at the nuance of each language the more difficult it is to convert out of context. In other code (based on VB6 from 1990’s and converted to VB.Net and evolved) lots of implicit assumptions about modules dating to when it was a stand-alone COM module.
Finally it would be help to have an undo. To be prudent I do this manually and have to convert CSPROJ reference back to VBPROJ so it’s not a crisis – just a convenience.
Bob Frankston
https://Frankston.com https://Frankston.com
From: GrahamTheCoder [email protected] Sent: Tuesday, May 28, 2019 03:48 To: icsharpcode/CodeConverter [email protected] Cc: Bob Frankston [email protected]; Author [email protected] Subject: Re: [icsharpcode/CodeConverter] VB -> C# LINQ Etc. (#316)
Thanks for raising this. It is indeed a tricky area.
I'd be interested to see more of the details of VB's async leniency. Sometimes these things can be "fixed" during conversion to choose some c# that does what the vb compiler would have done.
— You are receiving this because you authored the thread. Reply to this email directly, https://github.com/icsharpcode/CodeConverter/issues/316?email_source=notifications&email_token=ABJ4OND4NWUQEOKATYU7AETPXTPTJA5CNFSM4HP57NEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWLIPAY#issuecomment-496404355 view it on GitHub, or https://github.com/notifications/unsubscribe-auth/ABJ4ONC7DM6FJXTBXED7WIDPXTPTJANCNFSM4HP57NEA mute the thread. https://github.com/notifications/beacon/ABJ4ONG62ZLRSA3O7R4EIQDPXTPTJA5CNFSM4HP57NEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWLIPAY.gif
Thanks. The case of something that works due to lenience in VB, but not in c# is the case I'm interested in. E.g. Does VB add an await automatically somewhere. Does await in vb do a null check behind the scenes that should be replicated when converted etc.
I generally agree an undo function would be useful, mainly as a move towards a more step by step guide to conversion within the tool. For now I recommend using a version control system (such as git) to provide such functionality. However, I have attempted to provide a manual route, in the form of .bak files for files that are changed in the process (in addition to a confirmation dialog). A very simple script could automate restoring the bak files if there are a lot. Just to check, is there a specific shortcoming you're finding with one of those approaches that doesn't suit your use cases? (Even their discoverability)
Thanks, Graham.
My use case is doing my own projects which have evolved over 20 years. The async was added in a shift from using threads and when it worked well-enough I moved on. I will tell when I do figure it out but more likely will just cleanup the code overall so may not know the key thing I could’ve gotten away with.
What would help most is the ability to do incremental changes and go back without losing the tweaks I had to make. This is why I like the ideas of pragmas for LINQ – I can capture the knowledge rather than having to repeat the process each iteration.
Making a copy of the whole directory and naming back the CSPROJ=>VBPROJ works adequately for me. I presume production shops have better procedures so no need to do too much to accommodate me.
Another general issue is reference VB modules from other VB code after it changes to C#. For now I put that project aside because of the need to change other project. Not sure how to write C# code that is fully transparent. (going the other way “using static” is easier).
In any case, thanks again for all your effort.
Bob Frankston
https://Frankston.com https://Frankston.com
From: GrahamTheCoder [email protected] Sent: Wednesday, May 29, 2019 18:17 To: icsharpcode/CodeConverter [email protected] Cc: Bob Frankston [email protected]; Author [email protected] Subject: Re: [icsharpcode/CodeConverter] VB -> C# LINQ Etc. (#316)
Thanks. The case of something that works due to lenience in VB, but not in c# is the case I'm interested in. E.g. Does VB add an await automatically somewhere. Does await in vb do a null check behind the scenes that should be replicated when converted etc.
I generally agree an undo function would be useful, mainly as a move towards a more step by step guide to conversion within the tool. For now I recommend using a version control system (such as git) to provide such functionality. However, I have attempted to provide a manual route, in the form of .bak files for files that are changed in the process (in addition to a confirmation dialog). A very simple script could automate restoring the bak files if there are a lot. Just to check, is there a specific shortcoming you're finding with one of those approaches that doesn't suit your use cases? (Even their discoverability)
Thanks, Graham.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/icsharpcode/CodeConverter/issues/316?email_source=notifications&email_token=ABJ4ONAJZ4YAMSN4GB33OBTPX36EFA5CNFSM4HP57NEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWQZK6Y#issuecomment-497128827 , or mute the thread https://github.com/notifications/unsubscribe-auth/ABJ4ONEZNJ7GMPQJSNFJDX3PX36EFANCNFSM4HP57NEA . https://github.com/notifications/beacon/ABJ4ONGFMFOY7PNX7KEJUS3PX36EFA5CNFSM4HP57NEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWQZK6Y.gif
Next steps on this are to have a look at whether the equals operator in VB linq does the same as outside of linq, and whether we could detect a sql context for example and special case it.
LINQ expressions are parsed with no semantics. It’s 100% up to the particular implementation to decide, at runtime, what to do. In fact some databases are case sensitive and some are not. So the only correct conversion is to leave it as-is and, fortunately, that means we don’t need pragmas … except … that you don’t necessarily know if a particular delegate will be used in LINQ or will be used as code. I’d have to dig deeper to know all the rules.
BTW, key insight on async. I think I get away with it in VB because I’m invoking async methods in non-async context so VB doesn’t care.
Also to declare an async method parameter I had to convert “foo of action(of object)” to “foo of func(of object,task)” rather than an async keyword as I do in TypeScript (I have far more experience with async in TS than in C#). I did have trouble in VB with
a.ForEach(func(a) await handler(a0)
VB gave me now way to make the containing sub async so I had to kludge it and created a handler that recursed down each entry in A so that there are just simple async invocations. There is probably a far better way of doing it but whatever I can make work. Caveat – I haven’t tested the new code in production yet.
Private Async Function SendDeviceStatusStepHack(wsdrs As IEnumerable(Of WSDevReport), SendJSON As Func(Of Object, Task)) As Task
If wsdrs.Count = 0 Then Return
Await SendJSON(wsdrs(0))
Await SendDeviceStatusStepHack(wsdrs.Skip(1), SendJSON)
End Function
Friend Async Function SendDeviceStatus2(dev As iiDevice, SendJSON As Func(Of Object, Task)) As Task
Dim wsds = New WSDevicesReport(dev) ' Get matching devices
' wsds.devices.ForEach(Async Sub(wsdr) Await SendJSON(wsdr))
Await SendDeviceStatusStepHack(wsds.devices, SendJSON)
End Function
This was the version before I did the conversion to async
Friend Sub SendDeviceStatus(dev As iiDevice, SendJSON As Action(Of Object))
Dim wsds = New WSDevicesReport(dev) ' Get matching devices
wsds.devices.ForEach(Sub(wsdr) SendJSON(wsdr))
End Sub
Bob Frankston
https://Frankston.com https://Frankston.com
From: GrahamTheCoder [email protected] Sent: Sunday, June 2, 2019 17:10 To: icsharpcode/CodeConverter [email protected] Cc: Bob Frankston [email protected]; Author [email protected] Subject: Re: [icsharpcode/CodeConverter] VB -> C# LINQ Etc. (#316)
Next steps on this are to have a look at whether the equals operator in VB linq does the same as outside of linq, and whether we could detect a sql context for example and special case it.
— You are receiving this because you authored the thread. Reply to this email directly, https://github.com/icsharpcode/CodeConverter/issues/316?email_source=notifications&email_token=ABJ4ONCPJWMWLV5GYVSYZZDPYQZLXA5CNFSM4HP57NEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWX6CZY#issuecomment-498065767 view it on GitHub, or https://github.com/notifications/unsubscribe-auth/ABJ4OND6XAYP3GDGD6MK3JDPYQZLXANCNFSM4HP57NEA mute the thread. https://github.com/notifications/beacon/ABJ4ONCPFOSQ42ZG3NKTR3TPYQZLXA5CNFSM4HP57NEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWX6CZY.gif
Just an FYI I looked into how to return a null task object to keep VB happy
Return Task.FromResult(Of Object)(Nothing)
Bob Frankston
https://Frankston.com https://Frankston.com
From: Bob Frankston [email protected] Sent: Sunday, June 2, 2019 17:31 To: 'icsharpcode/CodeConverter' [email protected]; 'icsharpcode/CodeConverter' [email protected] Cc: 'Bob Frankston' [email protected]; 'Author' [email protected] Subject: RE: [icsharpcode/CodeConverter] VB -> C# LINQ Etc. (#316)
LINQ expressions are parsed with no semantics. It’s 100% up to the particular implementation to decide, at runtime, what to do. In fact some databases are case sensitive and some are not. So the only correct conversion is to leave it as-is and, fortunately, that means we don’t need pragmas … except … that you don’t necessarily know if a particular delegate will be used in LINQ or will be used as code. I’d have to dig deeper to know all the rules.
BTW, key insight on async. I think I get away with it in VB because I’m invoking async methods in non-async context so VB doesn’t care.
Also to declare an async method parameter I had to convert “foo of action(of object)” to “foo of func(of object,task)” rather than an async keyword as I do in TypeScript (I have far more experience with async in TS than in C#). I did have trouble in VB with
a.ForEach(func(a) await handler(a0)
VB gave me now way to make the containing sub async so I had to kludge it and created a handler that recursed down each entry in A so that there are just simple async invocations. There is probably a far better way of doing it but whatever I can make work. Caveat – I haven’t tested the new code in production yet.
Private Async Function SendDeviceStatusStepHack(wsdrs As IEnumerable(Of WSDevReport), SendJSON As Func(Of Object, Task)) As Task
If wsdrs.Count = 0 Then Return
Await SendJSON(wsdrs(0))
Await SendDeviceStatusStepHack(wsdrs.Skip(1), SendJSON)
End Function
Friend Async Function SendDeviceStatus2(dev As iiDevice, SendJSON As Func(Of Object, Task)) As Task
Dim wsds = New WSDevicesReport(dev) ' Get matching devices
' wsds.devices.ForEach(Async Sub(wsdr) Await SendJSON(wsdr))
Await SendDeviceStatusStepHack(wsds.devices, SendJSON)
End Function
This was the version before I did the conversion to async
Friend Sub SendDeviceStatus(dev As iiDevice, SendJSON As Action(Of Object))
Dim wsds = New WSDevicesReport(dev) ' Get matching devices
wsds.devices.ForEach(Sub(wsdr) SendJSON(wsdr))
End Sub
Bob Frankston
https://Frankston.com https://Frankston.com
From: GrahamTheCoder <[email protected] mailto:[email protected] > Sent: Sunday, June 2, 2019 17:10 To: icsharpcode/CodeConverter <[email protected] mailto:[email protected] > Cc: Bob Frankston <[email protected] mailto:[email protected] >; Author <[email protected] mailto:[email protected] > Subject: Re: [icsharpcode/CodeConverter] VB -> C# LINQ Etc. (#316)
Next steps on this are to have a look at whether the equals operator in VB linq does the same as outside of linq, and whether we could detect a sql context for example and special case it.
— You are receiving this because you authored the thread. Reply to this email directly, https://github.com/icsharpcode/CodeConverter/issues/316?email_source=notifications&email_token=ABJ4ONCPJWMWLV5GYVSYZZDPYQZLXA5CNFSM4HP57NEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWX6CZY#issuecomment-498065767 view it on GitHub, or https://github.com/notifications/unsubscribe-auth/ABJ4OND6XAYP3GDGD6MK3JDPYQZLXANCNFSM4HP57NEA mute the thread. https://github.com/notifications/beacon/ABJ4ONCPFOSQ42ZG3NKTR3TPYQZLXA5CNFSM4HP57NEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWX6CZY.gif
OK, I couldn’t resist. Converting sloppy (Je ne sais pas pourquoi) asynchronous code is scary. I used threading rather than callbacks in the early days for the same reason that async is superior to tasks/promises. Converting to async is tricky and the implicit semantics be difficult as in knowing when return as “Task” is the same as async – it seems to be.
Why use Operators.CompareString rather than string.Compare which doesn’t require including an extra library?
Also why DateAndTime vs DateTime?
I had to remove all those returns I put in for VB
Minor – generating a “break” after a “throw” .. compiler is picky about unreachable code
var foo = (int x) =>
doesn’t work. It needs to be a Func<> or, better simply an inline procedure as in
foo(int x) {
It seems to work now … thanks … or so I think … websockets seems to flake out so …
Bob Frankston
https://Frankston.com https://Frankston.com
From: Bob Frankston [email protected] Sent: Monday, June 3, 2019 11:19 To: 'icsharpcode/CodeConverter' [email protected]; 'icsharpcode/CodeConverter' [email protected] Subject: RE: [icsharpcode/CodeConverter] VB -> C# LINQ Etc. (#316)
Just an FYI I looked into how to return a null task object to keep VB happy
Return Task.FromResult(Of Object)(Nothing)
Bob Frankston
https://Frankston.com https://Frankston.com
From: Bob Frankston [email protected] Sent: Sunday, June 2, 2019 17:31 To: 'icsharpcode/CodeConverter' [email protected]; 'icsharpcode/CodeConverter' [email protected] Cc: 'Bob Frankston' [email protected]; 'Author' [email protected] Subject: RE: [icsharpcode/CodeConverter] VB -> C# LINQ Etc. (#316)
LINQ expressions are parsed with no semantics. It’s 100% up to the particular implementation to decide, at runtime, what to do. In fact some databases are case sensitive and some are not. So the only correct conversion is to leave it as-is and, fortunately, that means we don’t need pragmas … except … that you don’t necessarily know if a particular delegate will be used in LINQ or will be used as code. I’d have to dig deeper to know all the rules.
BTW, key insight on async. I think I get away with it in VB because I’m invoking async methods in non-async context so VB doesn’t care.
Also to declare an async method parameter I had to convert “foo of action(of object)” to “foo of func(of object,task)” rather than an async keyword as I do in TypeScript (I have far more experience with async in TS than in C#). I did have trouble in VB with
a.ForEach(func(a) await handler(a0)
VB gave me now way to make the containing sub async so I had to kludge it and created a handler that recursed down each entry in A so that there are just simple async invocations. There is probably a far better way of doing it but whatever I can make work. Caveat – I haven’t tested the new code in production yet.
Private Async Function SendDeviceStatusStepHack(wsdrs As IEnumerable(Of WSDevReport), SendJSON As Func(Of Object, Task)) As Task
If wsdrs.Count = 0 Then Return
Await SendJSON(wsdrs(0))
Await SendDeviceStatusStepHack(wsdrs.Skip(1), SendJSON)
End Function
Friend Async Function SendDeviceStatus2(dev As iiDevice, SendJSON As Func(Of Object, Task)) As Task
Dim wsds = New WSDevicesReport(dev) ' Get matching devices
' wsds.devices.ForEach(Async Sub(wsdr) Await SendJSON(wsdr))
Await SendDeviceStatusStepHack(wsds.devices, SendJSON)
End Function
This was the version before I did the conversion to async
Friend Sub SendDeviceStatus(dev As iiDevice, SendJSON As Action(Of Object))
Dim wsds = New WSDevicesReport(dev) ' Get matching devices
wsds.devices.ForEach(Sub(wsdr) SendJSON(wsdr))
End Sub
Bob Frankston
https://Frankston.com https://Frankston.com
From: GrahamTheCoder <[email protected] mailto:[email protected] > Sent: Sunday, June 2, 2019 17:10 To: icsharpcode/CodeConverter <[email protected] mailto:[email protected] > Cc: Bob Frankston <[email protected] mailto:[email protected] >; Author <[email protected] mailto:[email protected] > Subject: Re: [icsharpcode/CodeConverter] VB -> C# LINQ Etc. (#316)
Next steps on this are to have a look at whether the equals operator in VB linq does the same as outside of linq, and whether we could detect a sql context for example and special case it.
— You are receiving this because you authored the thread. Reply to this email directly, https://github.com/icsharpcode/CodeConverter/issues/316?email_source=notifications&email_token=ABJ4ONCPJWMWLV5GYVSYZZDPYQZLXA5CNFSM4HP57NEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWX6CZY#issuecomment-498065767 view it on GitHub, or https://github.com/notifications/unsubscribe-auth/ABJ4OND6XAYP3GDGD6MK3JDPYQZLXANCNFSM4HP57NEA mute the thread. https://github.com/notifications/beacon/ABJ4ONCPFOSQ42ZG3NKTR3TPYQZLXA5CNFSM4HP57NEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWX6CZY.gif
I'm open to using DateTime as part of a proper handling of #174, it actually did that sloppily until it was recently reverted in #261
I've just merged #317 which hopefully improves string comparison in some cases. The summary of why it sometimes uses a different method is because the methods do different things, and tracking down thousands of these little changes post conversion is not fun
As an FYI – I had to revert. For some reason the WebSocket wasn’t working right and I haven’t had a chance to track it down. I’ve got a lot of resilience my code so failures aren’t immediately visible.
That said, I very much appreciate the tools and will continue to try
DateAndTIme – ah ha – I just wrote “now” and didn’t realize in VB it was DateAndTime.now. I tried to eliminate the VB libraries which generated some errors. Am also moving more to string interpolation which should reduce some of the need for explicit conversion.
This is minor but converting from an enum using an implicit conversation generates an error
Dim foo as whatever = enum.none
Would it be correct to convert to?
Dim foo = ctype(enum.none, whatever)
BTW, when the error says “see comments” where are the comments?
Bob Frankston
https://Frankston.com https://Frankston.com
From: GrahamTheCoder [email protected] Sent: Monday, June 3, 2019 14:25 To: icsharpcode/CodeConverter [email protected] Cc: Bob Frankston [email protected]; Author [email protected] Subject: Re: [icsharpcode/CodeConverter] VB -> C# LINQ Etc. (#316)
I'm open to using DateTime as part of a proper handling of #174 https://github.com/icsharpcode/CodeConverter/issues/174 , it actually did that sloppily until it was recently reverted in #261 https://github.com/icsharpcode/CodeConverter/issues/261
I've just merged #317 https://github.com/icsharpcode/CodeConverter/pull/317 which hopefully improves string comparison in some cases. The summary of why it sometimes uses a different method is because the methods do different things, and tracking down thousands of these little changes post conversion is not fun
— You are receiving this because you authored the thread. Reply to this email directly, https://github.com/icsharpcode/CodeConverter/issues/316?email_source=notifications&email_token=ABJ4ONFE4GJHV53IDTCZ6VTPYVOWJA5CNFSM4HP57NEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODW2ITSI#issuecomment-498371017 view it on GitHub, or https://github.com/notifications/unsubscribe-auth/ABJ4ONFME2R5X3TE5A2CFFLPYVOWJANCNFSM4HP57NEA mute the thread. https://github.com/notifications/beacon/ABJ4ONBIN4A7KGGIWMT5VXTPYVOWJA5CNFSM4HP57NEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODW2ITSI.gif
Sorry to hear it didn't work yet. Glad the tools helped a bit though. Ah yes, VB has all kinds of special oddities that people don't realise they're even using. Makes things tricky!
The enum conversion sounds plausible off the top of my head, though if you're about to convert it, perhaps use something like Convert.ToInt32(myEnum.None) that will stay the same. In c# it can just be a cast like (int) myEnum.None
The positive side is that I’m finally getting my act together and trying to master async in C# which has for more mechanism that JavaScript.
As to the conversion – I’m converting to an object. The reasons go back into some problems I ran into yeas ago with named instances that were plan A. It actually returns a new object each time which made more sense when it was a structure.
Public Shared Widening Operator CType(ByVal hce As HCActionEnum) As HCAction
Return New HCAction(hce)
End Operator
Bob Frankston
https://Frankston.com https://Frankston.com
From: GrahamTheCoder [email protected] Sent: Monday, June 3, 2019 18:22 To: icsharpcode/CodeConverter [email protected] Cc: Bob Frankston [email protected]; Author [email protected] Subject: Re: [icsharpcode/CodeConverter] VB -> C# LINQ Etc. (#316)
Sorry to hear it didn't work yet. Glad the tools helped a bit though. Ah yes, VB has all kinds of special oddities that people don't realise they're even using. Makes things tricky!
The enum conversion sounds plausible off the top of my head, though if you're about to convert it, perhaps use something like Convert.ToInt32(myEnum.None) that will stay the same. In c# it can just be a cast like (int) myEnum.None
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/icsharpcode/CodeConverter/issues/316?email_source=notifications&email_token=ABJ4ONFIZUODXANFOXWUNJTPYWKP5A5CNFSM4HP57NEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODW23N3Q#issuecomment-498448110 , or mute the thread https://github.com/notifications/unsubscribe-auth/ABJ4ONCBRAAUHCVFUNLJZCLPYWKP5ANCNFSM4HP57NEA . https://github.com/notifications/beacon/ABJ4ONCQ75L4DKEWFDJGLETPYWKP5A5CNFSM4HP57NEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODW23N3Q.gif
Renamed this issue to focus on linq now the async issues are captured in #478