Hey there, Ken...
One comment and one question:
The code would be shorter if the Imports were done on a project basis, which VB lets you do. Then you don't have to write any of those Imports statements. <g> Very useful for something like the Toolkit which you want to use a lot.
Now the question:
Why not use the Toolkit? I'm seeing a number of people say things like "I only want to use *pure* .NET - as if user created function and class libraries aren't pure .NET". I never saw people in Fox/DOS days say "I won't create my own CityStateZip function because it's not pure Fox".
What's wrong with domain specific functions and classes?
yag
>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