It's not hard to convert VB.NET to C#. Most of .NET coding is using the
Framework, which is the same for both languages. Just read some basics about
C# syntax. Take some easy VB code, try and modify it to C# and see if it
compiles. Here is a little class I just rewrote in VB that show several
language features.
public class WorkerBee
{
public delegate void UpdateGui(string[] ar);
public event UpdateGui guiFunc = null;
private Thread thd = null;
public volatile bool bStopNow = false;
public WorkerBee(UpdateGui gptr)
{
guiFunc = gptr;
thd = new Thread (new ThreadStart (work));
}
public void Run()
{
thd.Start ();
}
private void work()
{
Debug.WriteLine (string.Format ("work() thd =
{0}",Thread.CurrentThread.GetHashCode()));
int k =0;
string [] sa = new string[10];
for (k = 0; k < 10000; k++)
{
if ((k % 10) == 0 && k > 0)
{
if (bStopNow) break;
if (guiFunc != null)
{
guiFunc(sa);
}
}
sa[k % 10] = string.Format ("string:{0}",k);
}
guiFunc(sa);
sa[0] = "101";
guiFunc(sa);
}
}
Imports System.Threading
Public Class WorkerBee
Public Delegate Sub UpdateGui(ByVal ar() As String)
Public Event guiFunc As UpdateGui
Private thd As Thread
Dim bStopNow As Boolean = False
Public Sub WorkerBee(ByVal gptr As UpdateGui)
AddHandler guiFunc, gptr
thd = New Thread(New ThreadStart(AddressOf work))
End Sub
Public Sub Run()
thd.Start()
End Sub
Private Sub work()
Debug.WriteLine(String.Format("work() thd = {0}",
Thread.CurrentThread.GetHashCode()))
Dim k As Int32 = 0
Dim sa(10) As String
For k = 0 To 100000
if ((k % 10) == 0 && k > 0) then
If (bStopNow) Then Exit For
RaiseEvent guiFunc(sa)
End If
sa(k Mod 10) = String.Format("string:{0}", k)
RaiseEvent guiFunc(sa)
sa(0) = "101"
RaiseEvent guiFunc(sa)
Next
End Sub
End Class
good luck,
kevin aubuchon
"GaryB" <gb@nospam.com> wrote in message
news:Oi**************@TK2MSFTNGP10.phx.gbl...
I am experienced in .net development using VB. Is there any material
available geared to someone that knows .NET and VB.NET to learn C#?
thanks,
Gary