Welcome to our official feedback forum for the code converter. If you spot problems with the converter, just leave a note here. **Please make sure you include a code sample***
-
19 votes
ViewState, Session or Request.Params not arrays
In my example below, none of the ViewState, Session or Request Params (arrays) have their round brackets converted to square brackets.
Example:
Protected Property CurrentSortColumn() As String
Get
If (ViewState("SortColumn") <> Nothing) Then
Return ViewState("SortColumn").ToString()
Else
ViewState("SortColumn") = "ADD_BOOK_ID"
Return "ADD_BOOK_ID"
End If
End GetSet(ByVal value As String)
ViewState("SortColumn")… moreStatus: under reviewUnfortunately we have no reliable way of knowing for sure that ViewState is an array rather than a method. We could guess for certain variable names (ViewState, Request etc) but this could confuse the issue further were these to conflict with actual methods... what do people think?
-
9 votes
trim
The syntax in VB is
returnValue = inputValue.Trim
When converting to C# it is not adding the "()" to the end of "Trim"
Status: under review -
6 votes
C# to Ruby or Python
The following converts to VB.net but not ruby or python:
for(int i = 0; i<1; i++){
Console.Write("i: "+i);
}Status: under reviewPat - if you place a class and method definition around the C# code, it will then convert to Ruby/Python :) We're looking at getting this fixed
-
4 votes
remove event handler
I've encountered a problem removing an event handler converting c# to VB (2008)
c# code:
void displayElement_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
VerifyEditVisualization(sender);
}void displayElement_GotFocus(object sender, RoutedEventArgs e)
{
VerifyEditVisualization(sender);
}
.
.
.
.foreach (FrameworkElement fe in _displayControls)//don't hang on to controls via event handlers
{
fe.GotFocus -=… moreStatus: under review -
3 votes
c# to python
//IClassSchemaEdit RegisterAsObjectClass Example
//e.g., configKeyword = "DEFAULTS" or ""
// nameOfSuggestedIDField = "MYID"
public void IClassSchemaEdit_RegisterAsObjectClass_Example(ITable table, string nameOfSuggestedIDField, string configKeyword)
{
//This function shows how to use the RegisterAsObjectClass method to
//register a DBMS table as an object class with the geodatabase.
IObjectClass objectClass = (IObjectClass)table; … moreStatus: plannedMatt - this works fine if you paste
class Test {
// code goes here
}around it. Will get this fixed anyhow - thanks for the heads up.
-
3 votes
Code converters: Add support for indexers
[from #kdmitry]
Here is one suggestion/bug report. VB to C# converter neglects/ignores indexers
Example:
C#:
private void IndexerUsageExample()
{
string[] someValues = new string[] { "A", "B" };
string value = someValues[1];
}Covert to VB: (so far so good)
Private Sub IndexerUsageExample()
Dim someValues() As String = New String()… moreStatus: under reviewThanks for the suggestion! Due to the way the converter works (by purely analyzing the syntax, rather than the meaning of the code), there's no easy way to detect whether something is a function call, or an array indexer. Potentially there would be a way to make a "best guess", but I'm afraid this one probably won't appear for a while yet.
-
2 votes
When converting from VB to C#, translate &= to +=
When converting from VB to C#, translate the &= operator to the C# += operator
Status: under reviewThe converter already does this. Can you provide an example where this doesn't occur?
-
2 votes
conversion problem with generic methods
i found the following issue converting generic methods from C# to VB.net:
List<TInner> innerGroup;
IEnumerable<TInner> innerEnum = innerGroup.AsEnumerable<TInner>();currently converts to:
Dim innerEnum As IEnumerable(Of TInner) = innerGroup.AsEnumerable(Of TInner)()should convert to:
Dim innerEnum As IEnumerable(Of TInner) = innerGroup.AsEnumerableas vb.net implies the generic parameter
Status: under reviewI'm not sure there's a general rule (unfortunately). For example, something like
Dim innerGroup As List(Of Object)
Dim innerEnum As IEnumerable(Of String) = innerGroup.Cast(Of String)()*is* valid. Does anyone have any thoughts on this?
-
2 votes
Support for VB.NET String functions
Add support for a variety of VB string functions:
1. Convert LCase and UCase to ToLower and ToUpper
2. Convert Left, Mid, and Right to Substring
3. Convert LTrim, RTrim, and Trim convert to TrimStart, TrimEnd, and Trim
4. Convert InStr to IndexOf
5. Convet Len to Length
6. Convert… moreStatus: under reviewWe have considered doing this, but these functions aren't actually a one-to-one mapping - they have entirely seperate implementations. On investigation there are several edge cases (such as passing null parameters) which will throw an exception in the main .NET implementations, but does not in the VB.NET implementation.
I think it's safer to leave these pointing to the old function calls and preserve their behaviour rather than introducing subtle bugs.
Thoughts?
-
2 votes
vb to C# collections indexers
First of all let me say that this tool is very good and useful especially as a web page, but there are a few things that I think are not right
and sometimes the code converted is not compiling or does not follow C# idiosyncrasies.
Dim newDTRow As DataRow
Dim… moreStatus: startedHi there :) Thanks for the feedback.
1 & 3 we can definitely sort out. #2 unfortunately is a bit more difficult, as we don't *know* if it's an array, or a method call from the vb.net syntax. we may add a "best guess" if it's a single parameter and the parameter name is i/j... thoughts?
-
1 vote
linq conversion problems
conversion ignores the linq statement:
Select New Pushpins({
Latitude = e.Element(xmlns + "Latitude").Value,
Longitude = e.Element(xmlns + "Longitude").Value,
Name = location,
Description = "Address: " + e.Element(xmlns + "Address").Value +
"<br/>City: " + e.Element(xmlns + "City").Value +
"<br/>State: " + e.Element(xmlns + "State").Value
})Status: under review -
1 vote
iif
Status: under reviewWe're actually cheating at the moment.
myObj == null? "Null" : myObj.Thinger
is getting converted to
If(myObj Is Nothing, "Null", myObj.Thinger)
(which is valid in VB.NET 9 onwards)
