Just a general question I've oftened wondered about, but we had an individual run code through a converter tool out of laziness that uses Microsoft.VisualBasic and Microsoft.VisualBasic.CompilerServices. Since we moved from vb.net into c# this code often
throws me for a loop as to why the individual left this converted code like this without a good reason and/or why the namespaces were necessary to import.
Since C# and VB.Net run on the same framework there are no performance issues if the original VB.Net code was written correctly and translated properly into C#. As for a sizing standpoint, once it is compiled it will be roughly the same from either C# or
VB.Net.
Does the code after conversion to C# throw an error if you remove the references and imports on the VB dlls? If it doesn't then leave them out. If it does throw an error then find each error point and replace the VB code with C# equivalents. I guess what
I'm saying is that it is probably better to go all C# if possible from a support standpoint even though mixing flavors is possible and usually works well.
thx for the response kraznodar. Yeah, I cant remove the namespace references or I'll have over a thousand errors. I agree from the support standpoint it would be much easier, just curious if using those namespaces in pages increased the sizing or had any
potential pitfalls or performance hits
Once the error count exceeds 200 I usually shift it to the "eventually I'll change it" category. There shouldn't be a performance hit although there will be a size impact roughly equal to the size of the 2 dll files when you publish it to the server. Even
that depends on what the server has on it. If you use the dlls already installed on the server the size impact is negligible. If the VB.Net dlls aren't already on the server and you have to publish them to the server as part of your application then you
would get the size increase. I don't think I've ever run into any pitfalls with the core dlls being mixed in a project. Maybe I'm just lucky but it hasn't happened so far.
Marked as answer by trag1 on Jan 18, 2013 05:19 PM
trag1
Member
22 Points
65 Posts
Worth importing MS.VisualBasic and VisualBasic.CompilerServices
Jan 18, 2013 04:31 PM|LINK
Just a general question I've oftened wondered about, but we had an individual run code through a converter tool out of laziness that uses Microsoft.VisualBasic and Microsoft.VisualBasic.CompilerServices. Since we moved from vb.net into c# this code often throws me for a loop as to why the individual left this converted code like this without a good reason and/or why the namespaces were necessary to import.
We have hundreds of lines like the following:
I guess my question is:
Is it worth it from a performance and sizing standpoint to import these namespaces to accomplish this kind of code in a C# application?
kraznodar
Contributor
3332 Points
881 Posts
Re: Worth importing MS.VisualBasic and VisualBasic.CompilerServices
Jan 18, 2013 04:49 PM|LINK
Since C# and VB.Net run on the same framework there are no performance issues if the original VB.Net code was written correctly and translated properly into C#. As for a sizing standpoint, once it is compiled it will be roughly the same from either C# or VB.Net.
Does the code after conversion to C# throw an error if you remove the references and imports on the VB dlls? If it doesn't then leave them out. If it does throw an error then find each error point and replace the VB code with C# equivalents. I guess what I'm saying is that it is probably better to go all C# if possible from a support standpoint even though mixing flavors is possible and usually works well.
trag1
Member
22 Points
65 Posts
Re: Worth importing MS.VisualBasic and VisualBasic.CompilerServices
Jan 18, 2013 04:52 PM|LINK
thx for the response kraznodar. Yeah, I cant remove the namespace references or I'll have over a thousand errors. I agree from the support standpoint it would be much easier, just curious if using those namespaces in pages increased the sizing or had any potential pitfalls or performance hits
kraznodar
Contributor
3332 Points
881 Posts
Re: Worth importing MS.VisualBasic and VisualBasic.CompilerServices
Jan 18, 2013 05:03 PM|LINK
Once the error count exceeds 200 I usually shift it to the "eventually I'll change it" category. There shouldn't be a performance hit although there will be a size impact roughly equal to the size of the 2 dll files when you publish it to the server. Even that depends on what the server has on it. If you use the dlls already installed on the server the size impact is negligible. If the VB.Net dlls aren't already on the server and you have to publish them to the server as part of your application then you would get the size increase. I don't think I've ever run into any pitfalls with the core dlls being mixed in a project. Maybe I'm just lucky but it hasn't happened so far.