Convert VB.NET --> C# Projects [closed] - c#

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Can anyone recommend a good application that could be used to convert VB.NET projects to C#, without having to do too much manual work?
We've used Reflector to do small libraries manually, but some of the larger projects will be too slow and complex to do this manually.

You can use Lutz Roeders Reflector (http://www.red-gate.com/products/reflector) which can decompile whole Assemblies into Visual Studio projects. This way you can convert from ANY .NET Langauge into one of the supported languages of this program (C#.VB.NET,MC++,Delphi,Chrome)

Tangible Software do various converters, including VB to C#.
I've played with it a little bit as they're kind enough to give me a copy for free, but I can't say I've stress-tested it. When I've used it it's been fine though - certainly worth a try.

A few things to keep in mind...
1) Depending on how the VB.Net code was written, automatic conversion may or may not be 100% possible. VB.Net allows a "looser" coding style that would be ambiguous to C#. So, some manual intervention may be needed.
2) If the VB.Net code functions correctly, you may want to just leave it as VB.Net. Both VB.Net and C# projects can co-exist within the same solution.

The far best tool for this is Econ Netvert which can be found on CodePlex
http://www.codeplex.com/econnetvert

SharpDevelop has this feature, but I haven't used it enough to know if works reliably. It seems to be a pretty good otherwise, so it's worth a try though.

The best and fast converter I have seen so far is http://converter.telerik.com/
Nicely presented using RAD AJAX Controls.
Note: It converts only code snippets and not projects as a whole.

There's also the free online converters up at developerfusion :)

SharpDevelop is quite good, but at my company we've found VBConversions to provide a much more complete conversion. It's a commerical app though, but for the time saved over SharpDevelop it was a no-brainer for us.
As a specific example, one thing we found that SharpDevelop didn't convert correctly was VB indexes, which use curvy brackets. It seemed unable to distinguish between indexes and method calls so didn't convert the indexes to square brackets. VBConversions converted them fine. This one thing made it worth its purchase for us.
It looks like the Tangible Software product works very similarly to VBConversions.

Related

Is there an easy way to refactor between coding practices to C#4 from C#1,C#2 and C#3 [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I am going to admit that I am battling with changing face of C# and unlearning what I learnt since starting out with C#1.
I started years ago writing greenfield C# 1.1 code and also currently work a lot with maintenance work on code that is written with previous versions of C#.
Being exposed to the old ways of doing things is hard as I am battling to unlearn from code what I have written in the past and that I have to look at daily that was written in previous versions of C#. Having to maintain Java projects also doesn't help as it is similar to C#1. With time I could probably unlearn my bad practices but with project deadlines it is hard to do.
My lazy mind also is against me as its logic says if I use OO and DRY principles and the code compiles my boss is happy and thinks all is good when I am just not simplifying my code with new ways of doing things.
I have started reading Jon Skeet's C# in depth 2ed as what it does it gives the code solutions to do a specific tasks for each of C#1,C#2,C#3,C#4 each time showing the code examples how it simplifies code but I am finding it hard to remember and put into practice these new methods due to having to still deal with all this legacy code daily and still having to balance my jack of all trades dev jobs.
Is there an easy way to refactor between coding practices from C#1,C#2,C#3 to C#4 either on the fly or at compile time and give suggests either in English language or refactor the code for me.
Is there anywhere like a tool or a site I can see the changes for the same code between the C# versions excluding Jon Skeet's C# in depth book?
The latest version of ReSharper would be a helpful tool to move your C# forward in many respects quickly. It will point you to newer practices and make it quicker & less painful to employ them across existing code.
A couple forward-looking ReSharper refactorings that come to mind are:
Static to Extension Method...
Property to Auto Property...
Also, ReSharper will, for example, encourage you to use var for implicit declarations where possible.
CodeRush can do much the same, but I have not used it as recently.
To see the difference between where such tools' refactorings put you and where you started, diffing against prior revisions of your files in source control comes to mind.
For changes to the .NET BCL alongside C# as #stakx points out, consider digging into build warnings regarding deprecated code built against newer versions of .NET. Once you learn (as just one example) to replace uses of System.Xml.XmlValidatingReader with System.Xml.XmlReader, making the change in other places flagged for the former deprecated type will become quick.
What's Obsolete in the .NET Framework on MSDN characterizes the most recent BCL deprecations since .NET 1.1 and how to update affected code.

C++ vs C# for GUI programming [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am going to program a GUI under windows (will be about 10,000 line code with my estimates) and don't know C# or C++ (QT library) to choose for my needs. Please help me to choose.
If you have to debate on using C# or C++ then the correct answer is probably C#. I would stay away from a low level language like C++ unless you absolutely have to as the amount of time required to develop/debug with it will be much greater. C# has a lot of GUI functionality that it harnesses from the .NET framework. There isn't a lot you can't do with it right out of the box as opposed to C++ which you'll have to hand code a lot of functionality.
If you are developing a Windows application I'd suggest using C# and the .Net Framework as they are the 'native' solution. Using QT is just going to add complexity as it's a cross-platform library and has additional concerns therein. I'd also suspect the support for the .Net Framework is likely to be greater and more widespread.
The overarching question would be, which programming language are you most familiar with. If there is a Windows compiler for it then use that!
Use .NET if your only target is Windows. It is much more productive and you have better IDE support for development of GUI. The disadvantage is that you need to have .NET framework installed on the machine your application will run on.
If you consider going cross platform, or you think you master Qt (and C++) more than .NET, then go on with Qt.
I'd prefer C#.. In some cases is easier to distribute (windows 7 comes with .NET). Microsoft showed that the future is in WPF, so why wait to adopt it
Choose the GUI toolkit based on your requirements, then choose the language.
if QT fits the bill, then C++, if WinForms looks good, C#, if MFC (and the new feature pack) is good enough, C++ ....
Also, depending on your skill (and the skill of your team) of one language or the other, your decision might be easier.
What are the requirements? If the performance is not an issue then I would go with C#.
I think the question should be using c++, .net winforms or wpf.
You will never use c# lonely to build it, you will use the IDE.
If you need something visual I should use wpf, otherwise I would use .net winforms. You can mix them too.
Regards.
One other option you may want to consider is gtksharp if you want to use c# but would like to target multiple platforms.

As a .NET beginner, what should I learn and where can I find open source projects? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I'm beginner programmer in the amazing world named ".Net".
I've a lot of questions
well, what I should learn C# or Vb.net
What's the best blogs which talk about .Net technology and Open source projects
Where can I find good tutorials, free books and ideas of projects
how can I progress in ".Net"
please, share your knowledge , your OPML of your favorite blogs or web sites about ".Net "
I'm waiting your advices, opinions, etc.
As far as which language you should learn, well what are your experiences thus far? I prefer C# over VB.NET. Though, eventually, you should be able to program in VB.NET even if you say with C# as your primary language (the same is true vice versa for VB.NET). You might want to check the syntax of each language and see which you prefer just by first glance. You will probably find that whenever code examples are provided for .NET and both languages aren't present, typically the examples are in C#. This is not a big deal though. I find C# (and similar languages) to be less verbose but that is a preference. Here are some good resources. I highly recommend the LearnVisualStudio.NET videos; start with the beginner tutorials and advance to more advanced topics.
Some great resources include:
http://www.dotnetrocks.com (podcast)
http://www.se-radio.net (general software engineering podcast)
http://www.haacked.com (Phil Haack's blog)
http://weblogs.asp.net/scottgu/ (Scott Guthrie's blog)
https://stackoverflow.com/questions/551315/which-c-net-blogs-do-you-read (previous question with a good list of blogs)
http://www.learnvisualstudio.net (good place to find video courses, cheap)
https://stackoverflow.com/questions/54423/best-net-podcasts (previous question)
What good technology podcasts are out there? (more podcasts)
Open Source projects:
http://www.codeplex.com is great for Open Source .NET projects.
Also:
http://csharp-source.net/ (not bad, some projects are old and not maintained)
http://sourceforge.net/softwaremap/trove_list.php?form_cat=271 C# as SourceForge
Open Source C# Opportunities (previous question with good infor)
Also check http://www.codeproject.com/
I'd start with Fabulous Adventures In Coding, which is a great blog by one of the people who actually work on C#. Then i'd also take a look at CodeProject and MSDN. Finally, you can't forget Joel Spolsky's web site!
For Regexes, look no further than here. Cosmos is a neat project though a little heavy for beginners, and DevExpress has the best VS addin this side of the earth! Personally, i don't like ReSharper but plenty of other people do.
(marking it CW so anyone can contribute)
Excellent suggestions so far. Another site to always keep in mind for open source code is Google Code. Plus Google has excellent search features for finding just about anything in their code base.
Things i am following
https://stackoverflow.com/
http://www.codeplex.com/
http://msdn.microsoft.com/hi-in/default.aspx
If you are interested in web development, check http://www.asp.net.
Also, checkout MSDN Magazine, 4 Guys From Rolla, and the Linq Project.
You can find a Comparison of C# vs VB.NET here
Also this Article in CodeProject describes the complete differences between C# and VB.NET. You will get large number of opensource projects from CodeProject
You can find an exiting project TextPad, which will help you to learn more in C#
I also had these question in my mind when I started learning .NET. I prefer C# over VB. But then its purely a personal choice. In my view start with a nice book like Beginning Microsoft Visual C# 2008 or Head First C#. And the online source which I find very useful MSDN.
As to your question whether to learn VB.NET or C#... Well, there are personal preferences and there are realities.
If you want to make a living out of this, keep in mind that relatively and generally speaking c# will make you more employable.
Example. As of right now, Dice lists 4421 matches for c# versus 1131 for vb.net.
I can recommend "Beginning ASP.NET 3.5 in C# 2008: From Novice to Professional" from Mathew MacDonald. It does not rely on deep C# knowledge and even for someone who knows C# it's interesting to read. I'm almost half through, and it is really nice to read.
Don't be shocked by the almost 1000 pages - lots of code listings and pictures are inside.
I think there is even a VB.NET edition, but I prefer C# - and I still think that this is the language Microsoft puts more focus on.
For GDI (graphics) programming in C# / VB.Net, look at the "Beginners guide to GDI+" section at bobpowell.net.
I have worked through many of the advanced topics, and they're very well written and give great examples.

Using Java-classes with C# [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have a project written in Java (>1.5).
Is it possible to write parts of the project with C#?
For instance the GUI and calling the methods and instantiate the classes written in java?
If yes, how?
I am author of jni4net, open source intraprocess bridge between JVM and CLR. It's build on top of JNI and PInvoke. No C/C++ code needed. I hope it will help you.
Not without something like ikvm - or using web services etc to communicate between the two sides. Basically it's likely to be much more work than either rewriting your existing project code in C# or writing the GUI in Java.
There is something called Java Language Conversion Assistant for .NET. You can convert your Java classes to c# and start coding.
There is also something called JNBridge (not free).
It seems like my solution is very limited. and apply only to specific version of java.
I probably will stay with old good C :) Can't imagine how to work without shared libraries :)
This document explain how to create a dll from java and use it in C code. I'm not C# or java expert but i'm sure that you can load external dll's in C# as well. So not a complete solution but good starting point, IMHO.
Generally dll it's a perfect way to mixing languages.
In simple way you can pack your java classes to jar file then
In C# use Process class for execute and map IO stream
I did some research on this a few years ago (2005 I believe) and I liked JNBridgePro as the best third party product to do this. Check it out here http://www.jnbridge.com/
Good luck!

Interview question on C# and VB.net similarities/differences [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have been a VB.net developer for a few years now but I am currently applying to a few companies that use C#. I have even been told that at least one of the companies doesn't want VB.net developers.
I have been looking online trying to find real differences between the two and have asked on crackoverflow. The only major differences are a few syntax difference which are trivial to me because I am also a Java developer.
What would be a good response to an interviewer when they tell me they are looking for a C# developer - or similar questions?
I've had to interview people for a few C# positions and this is my general advice for VB.Net developers interviewing for a C# position:
Make sure you are clear that you have been working VB.Net. This seems obvious but is something that apparently isn't (in my experience).
Try to give a code sample, if possible. I've seen some horrible VB.Net (and C#) written by VB programmers who didn't seem to learn much in the transition to .Net.
Be able to write in C# during the interview, if asked. I know there aren't many real differences between the two, but I don't want to pay you to learn the new syntax.
For your specific question: I've asked that type of question before and what I wanted to hear about was how the underlying system and framework were the same. If possible, talk about garbage collection, IDisposable, finalizers, the dangers of unsafe code blocks, stack vs heap, etc. All the kind of stuff to show that you really understand the intricacies of the .Net framework. Right or wrong, the heritage of VB brings with it an expectation of a lack of understand of lower level programming and windows in general (which, ironically enough, a c++ developer would have of a c# developer... and so on).
Lastly, how you frame your experience can make a world of difference. If you position yourself as a .Net developer, rather than VB.Net or C#, the stupid, pseudo-religious, banter may not enter the conversation. This of course requires that you actually know both VB.Net and C# at the time of the interview, but that's a good policy regardless.
The truth of the matter is that if you find that the person interviewing you writes you off simply because you've previously been developing in VB.Net, it's likely not going to be a place you want to work at anyway.
Some differences (that are more substantial than syntactical) that suitably catch me out sometimes:
VB.NET does not have anonymous delegates
Unsafe code blocks aren't in VB.NET
I love C# to death, but I envy VB.NET's optional parameters. Office automation in C# is so very, very painful.
I think the truth will-out on this:
I'm a software developer, the syntax of the language is the final part of the puzzle. By employing me, you're getting someone with demonstrable experience of problem solving and logic. I'm experienced with the .NET environment, the CLR and the associated Windows stack, including SQL and Windows server. I don't know the C# syntax, but, I am used to object-oriented approach, I will have no problem getting totally up to speed on the finer points of the syntax within a couple of weeks. You can see from these examples of my code that I'm an experienced developer, I assure you the transition will be seamless. I have already made a start learning the language, I haven't had any problems so far.
#DAC - VB now (in .net3.5) has support for lambdas:
Function(x) x.ToString()
In an interview I'd say that understanding the CLR and what the code's really doing is what's important, and that you're happy to code in either (assuming that you are).
I'm also a C# feller to the death but the differences are not just syntax. There are places where VB wins HANDS down
Optional parameters
Late binding
Working with COM from C# can be a very frustrating affair. (Which is not to say impossible!)
Truthfully? If you're a Java developer too, I'd lead with that. A Java developer with some experience in .NET will generally make a better impression than a VB developer with experience with Java. If you can answer questions on the difference between .NET and Java you should be in good shape.
I'd also recommend you learn the C# syntax ASAP. If you're experienced with VB and Java it won't take long.
A lot of developers have issues with VB and the people that use it. Valid or not you'll have to deal with that reality.
VB or C# both are syntax only diffrent but if you are applying way of logic is same.

Categories