Tammam Koujan

Casting Error

converting this line of code:
int result = MyCmd.ExecuteScalar() as int;
give this result
Dim result As Integer = TryCast(MyCmd.ExecuteScalar(), Integer)
witch give this error
'TryCast' operand must be reference type, but 'Integer' is a value type.


Feedback by Tammam Koujan Status: Not Done Comments: 0 Last update: 2013-11-12T12:15:23 by Tammam Koujan
0
Tammam Koujan

error when converting to char type

converting this line
e.KeyChar = (char)0;
give :
e.KeyChar = CChar(0)
which raise an error , it should be
e.KeyChar = ChrW(0) or e.KeyChar = Chr(0)
Thank you
Problem by Tammam Koujan Status: Not Done Comments: 0 Last update: 2013-11-11T11:59:38 by Tammam Koujan
0
Fco M

lambda with correlated linq query

correlated select from linq is not converted when used inside lambda expresion:
int index = 0;
var workload = grouplist.GroupBy(j => new { j.LOGIN_ID, j.FULL_NAME,j.TEAM_NAME})
.Where(k => k.Key.TEAM_NAME == membergroup)
.Select(i => new
{
CoreID = i.Key.LOGIN_ID,
TicketCount = tickets
.Where(k => k.Assignee_Login_ID == i.Key.LOGIN_ID && k.Assigned_Group==i.Key.TEAM_NAME)
.Count(),
Assignee = i.Key.FULL_NAME,
url = @"~\images\man_" + (1 + (index++) % 5) + ".png"
}).ToList();
Feedback by Fco M Status: Not Done Comments: 0 Last update: 2013-10-21T05:19:47 by Fco M
0
Todd King

Converter does not append Iterator keyword to VB code with yield

If you try to convert the following C#

using System.Collections.Generic;
namespace MyNamespace
{
public class MyClass
{
public IEnumerable<int> GetLengths(IEnumerable<string> arg)
{
foreach (string input in arg)
{
int length = input.Length;
if (length > 10)
yield break;
yield return length;
}
}
}
}

The VB produced does not build because the "Iterator" keyword is not being appended to the method.
Problem by Todd King Status: Not Done Comments: 0 Last update: 2013-09-10T00:05:30 by Todd King
0
Todd King

Converted does not append "async" keyword

The converter does not append the async keyword when converting async methods:

using System.Threading.Tasks;
namespace ANamespace
{
public class AClass
{
public async Task<string> MyAsyncMethod(string msg)
{
string otherString = await Task.Run<string>(() => "Foo");
string result = await Task.Run<string>(() =>
{
string temp = msg + otherString;
return temp;
});
return result;
}
}
}

If you try converting that to VB using the converter, the build will fail due to a missing async keyword.
Problem by Todd King Status: Not Done Comments: 0 Last update: 2013-09-09T23:47:29 by Todd King
0
Todd King

Converter has bug converting action delegates

When the converter goes to convert the following code:

using System;
namespace ANamespace
{
public class AClass
{
public string AMethodWithLambdas(string msg)
{
int i1, i2 = 2, i3 = 1 + 2;
AClass myObj1, myObj2 = new AClass(), myObj3;
Action act1, act2 = () => Console.WriteLine("Hello World"), act3 = AClass.MyAction, act4 = () => { Console.WriteLine("Line1"); Console.WriteLine("Line2"); }, act5, act6 = () => { AClass.MyAction(); }, act7;
Func<string, string> convertString1,
convertString2 = AClass.MyConvertString,
convertString3 = (string input) => input + "FooBar",
convertString4 = (string input) =>
{
string temp = input + "Alpha";
return temp;
};
return convertString2(msg) + convertString3(msg) + convertString4(msg);
}

private static string MyConvertString(string arg)
{
return arg.ToLower();
}

private static void MyAction()
{
Console.WriteLine("I did something!");
}
}
}

It improperly converts act2 to :
act2 As Action = Function() Console.WriteLine("Hello World")
when it should be
act2 As Action = Sub() Console.WriteLine("Hello World")
Problem by Todd King Status: Not Done Comments: 0 Last update: 2013-09-09T22:51:02 by Todd King
0
Displaying items 71 - 76 of 76