Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VB -> C#: Convert constant values correctly [#329] #409

Merged
merged 2 commits into from Nov 11, 2019

Conversation

@mrmonday
Copy link
Contributor

mrmonday commented Nov 11, 2019

Add explicit handling for conversion of constant values, since we cannot
directly call the conversion functions at runtime.

Fixes #329

Problem

Constant values that require conversions would lead to code which fails when converted to C#.

Solution

Add explicit handling for constant values - call the relevant Conversions.ToXXX() method at conversion time, rather than making a runtime call. I couldn't find a Roslyn API for doing this with less code - if there is one I'd be happy to change it.

  • At least one test covering the code changed
mrmonday and others added 2 commits Nov 11, 2019
Add explicit handling for conversion of constant values, since we cannot
directly call the conversion functions at runtime.

Fixes #329
@GrahamTheCoder GrahamTheCoder merged commit 6c94fb4 into icsharpcode:master Nov 11, 2019
2 checks passed
2 checks passed
icsharpcode.CodeConverter Build #20191111.7 succeeded
Details
icsharpcode.CodeConverter (Job Config_Release) Job Config_Release succeeded
Details
@mrmonday mrmonday deleted the mrmonday:329-const-literals branch Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.