Last post Jan 07, 2014 12:25 PM by deeshubby
Jul 24, 2013 01:25 PM|DonnieS|LINK
I am strongly considering converting my app from cshtml to vbhtml - I have a calculation item that I started writing in c# in the @functions area of app_code and I would much rather write it in VB. What kind of gotchas are there in converting ?
Jul 24, 2013 01:36 PM|Rion Williams|LINK
If the area is just within the functions section and contains purely server-side code, you could likely use something like
Telerik's C# to Visual Basic (or vice versa) Converter to convert the code. (There isn't going to be any particular "gotchas" aside from the normal differences between the languages.)
It isn't completely perfect, but I am sure that if you run into any issues anyone here would be glad to assist you with the rest of the conversion.
Jul 24, 2013 01:40 PM|DonnieS|LINK
Rion, as I understand it, within App_Code, it is illegal to have a .cshtml and a .vbhtml file , is that true? And couldnt I in the regular part of the app (not the app_code) , couldnt I just convert one procedure at a time from cshtml to vbhtml?
Jul 24, 2013 01:41 PM|dblaire|LINK
If you're from a VB background, VB.Net will be easier. C# is by far the more popular language. Also C# has a much larger share of examples on the web, and support tends to be easier to get. Either way, if you learn one, you can pick up the other in 5-10
Jul 24, 2013 01:51 PM|dblaire|LINK
You can have both vbhtml and cshtml files in the same site, but you cannot mix the two in App_Code. Hence you can convert one web page at a time from cshtml to vbhtml.
Jul 24, 2013 01:54 PM|Rion Williams|LINK
Correct. (the App_Code folder is typically used to store actual objects and model classes and not "Views")
If you are from a Visual Basic background, then I would highly suggest using .vbhtml pages instead of .cshtml pages, simply because it will be much easier for your to work with.
I don't really foresee any major issues converting the procedures one-by-one, however just make sure that the code that you are converting (if you are using some automated mechanism to handle the conversion) only contain actual C# or Visual Basic
code and not any "markup".
Don't hesistate to ask if you run into any issues with the conversions as we will be glad to help.
Jul 24, 2013 04:02 PM|DonnieS|LINK
Thanks for your help Mike and Rion, I think I am going to leave it in C#, spent plenty of time in vb, so I have the opportunity and fun of learning more about C#.
Jan 07, 2014 12:25 PM|deeshubby|LINK
My current employer requires everything to be authored in VB.NET as much as possible.
I had a situation where my VB.NET asp web project required some image processing techniques that required some edge-case pointer management that I think was uniquely suited to C#
I simply kept the C# specific logic in a separate project, referenced it in my VB solution (yes, a project reference) and was able to use it just fine.
Long winded way of saying, "put your VB.NET logic in it's own DLL / project - and your C# solution can bring it in just fine, as either a traditional DLL reference, or a more fluid 'project' reference"