Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP vs .NET and To C# or VB
Message
From
17/05/2002 10:29:13
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00657468
Message ID:
00658196
Views:
43
Ah - OK, I see - I can see where that would be easier for many. I suppose I'm more interested in the object-centric-approach, which is why that doesn't make a lot of difference for me.
I would also point out that the VB code in your example is, in total, a good bit (percentage wise) longer ;-)

BTW - thanks for the toolkit - While I don't see myself using it in production, Chuck Urwiler pointed out that it will be a great tool to help in "learning" .NET - i.e. translating from VFP functions to classes. I agree and plan on using it this way.

>Hi Ken,
>
>>Kamal - guess I'm missing something here. I can do a "using My.Name.Space" and refer to static class methods the same way I would functions in VFP or as you seem to be describing - i.e. with no class preface. What is the difference between this and what you are saying VB does?
>
>If we create a static method of a class the only way to access it from C# is via Class.StaticMethod(). VB .NET provides a way to bypass the class name and simply call StaticMethod().
>
>In case of the VFPToolkit, it has 10 classes that expose static methods for all the VFP functions. Here is an example that converts a file to a string in both VB.NET and C#.
>
>
>Imports VFPToolkit.strings    'strings is actually a class
>Imports VFPToolkit.dialogs
>Imports VFPToolkit.common
>
>Dim lcFile, lcString As String
>lcFile = GetFile()
>
>If Not Empty(lcFile)
>   lcString = FileToStr(lcFile)
>End If
>
>
>Here is the C# example:
>
>using VFPToolkit;
>
>string lcFile, lcString ;
>lcFile = dialogs.GetFile();
>
>if(!common.Empty(lcFile))
>   lcString = strings.FileToStr(lcFile)   //or VFPToolkit.strings.FileToStr()
>End If
>
>
>In this case we had to prefix the class name such as dialogs.GetFile(). There is always intellisense, so it is not that big of a deal and C# also provide a way to specify aliases:
>
>using vfpS = VFPToolkit.strings;
>using vfpd = VFPToolkit.dialogs;
>...
>
>// from code we simply access using vfpd.GetFont()
>
>
>hth,
>Kamal
Ken B. Matson
GCom2 Solutions
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform