Is there an online resource or database that allows looking up the C# equivalent to a Java class and vice versa?
I have been porting code and have been Googling individual classes one at a time; it gets a little tedious. 8^j
Cheers
something as simple as this: http://www.harding.edu/fmccown/java_csharp_comparison.html
or more about the libraries available on each?
1 * Google "C# api" = http://msdn.microsoft.com/en-us/library/d11h6832(v=vs.71).aspx
Rosetta Code is a nice approach, though it is more comprehensive than you're after. The goal of the site is to show the same task being done in as many languages as possible. For example, for File IO, you could search for the Java and C# versions and compare them.
Related
For a large porting from VB6 to C# job I wrote a tool which uses a murder of regular expressions to analyse a VB6 code base and extract the dependencies of all the functions in all the forms, bas files and classes.
It allowed us to chop out blocks of code for the developers, generate graphs and extract all the SQL.
I could really use something that does the same thing for C# and although it would be a lot easier for C#, I don't have the time or budget to write it.
We are limited to VS2008
Does anything like this already exist?
I'm not sure but I think NDepend has this. If not, writing it yourself should be pretty straight forward using Roslyn or NRefactory
If you take a look on project Roslyn page, you'll find example which will show you about 70% of what you seem to try to achive.
Walkthrough: Getting Started with Semantic Analysis – C#
It seems you are doing some kind of "refactoring". I found ReSharper is most useful in this case http://www.jetbrains.com/resharper/
I am refreshing my memory on C# (first used it several years ago), and I want to look at some real world quality code (rather than the simplistic ones used in many books).
My preference would be mathematical/statistics libraries written in C# as I would like to see how Matrices and PDEs (partial differential equations etc) are implemented in C#.
Can anyone recommend a good quality online resource where I can view some 'industrial grade' preferably (Math/Stats) library/application written in C#?
Math .NET may be will be interesting for you.
You might be interested in WPF Dynamic Data Display.
Mono (an open source, cross platform implementation of .net) is also open source.
Numerical Methods and the related projects might be of interest.
Is it possible to convert code from Java to C# or VB.net to C#?
You could decompile the VB.NET code using Reflector (http://www.red-gate.com/products/reflector/) to get it as C#. You might also try someting like this online converter http://www.developerfusion.com/tools/convert/vb-to-csharp/
Try Telerik Code Converter for a free C#/VB code converter. I've used it - it isn't bad. There are also many commercial ones with lots of features.
Java and C# are very similar and converting between the two (and to/from VB) is possible. A quick search should reveal many commercial options.
If you know a little bit of both C# and Java, converting Java to C# by hand would be the best route to go. That's what I did for a relativley medium sized Java project. Then you can use Sharpdevelop (http://www.icsharpcode.net/opensource/sd/) to convert C# to VB and vice versa.
For Java to C# &VB.Net, you can also use Tangible Java to VB & C# Converter.
http://tangiblesoftwaresolutions.com
I hope this could be useful. But it might not work with complex code structures..
https://varycode.com/converter.html
I am looking to switch to C#. I come from a C / C++ background but C# is a little different for me. I am switching mainly because of Silverlight and MVVM; all examples are in C#. Any information is in C# and I am confused when I read through it all.
What is a good place to start learning C# when starting with existing C / C++ knowledge?
Start writing code in C# ASAP. Only way to learn the language is to write it. You already understand VB.NET. You've got a huge lead on anyone new to .NET.
Take a smallish application you've written in VB.NET and methodically change it over to C#.
You'll learn the syntax, etc. quickly.
Write all of your future projects in C#. Just force yourself into the change and you'll do fine.
Read the best C# books. :)
The Wikipedia article "C Sharp (programming language)" is a decent introduction to C# as a language.
Shortly after learning VB.NET I decided I'd rather be coding C#. I learned it by reading a couple of books and working on a project. Slowly, I got my coworkers converted over to the language from VB.NET as well. The languages are very similar, some code conversion is just a matter of changing syntax.
However, if you've ever worked with a true VB'er you will see VB specific functions used in their code that'll make you scratch your head. There are string handling functions and casting functions for example that you will have to convert. Also, C# has no RaiseEvent. Events take a little more effort to understand in C# because you need to wrap your mind around delegates (C++ function pointers/callbacks). As others have said, if you are coming from C++ this shouldn't be too difficult.
Many people go on about needing to work on a project to understand a language, which I agree with. However, there are features of languages which you will never know about if you don't pick up a couple of books and read about them. I've been able to show my coworkers many useful techniques just by reading a couple of books.
Lastly, C# is a great language. I was very skeptical when I first started using .NET, but now I know that MS got the right talent together for that framework and language.
Good luck.
As you know C++ (as you wrote in the question) and VB.Net (as you mentioned in the title), C# won't be hard for you if do know them both well. If this is the case, just grab any source in C#, and read it.
By the way, the article from wikipedia is a very nice intro.
One thing that may work for you is to use a converter
Write your desired code in VB.
Paste small pieces of code you don't know how to write in C# into http://converter.telerik.com/ and convert.
Manually type the result into your C# project.
Gradually, reduce your reliance on converter as you become more familiar with language.
That is enough to get you started, however C# has language features that VB does not, or VB offers in a way that is so wordy that no one really uses it.
The more features you will come across as you look at code examples from around the web (like on stack overflow), and you need to either look up syntax or function manually, or convert from C# back to vb to understand what it is doing (use same converter). Or, just paste it in and see what it does.
I have a small (~2000 lines of code) class that I would like to use from both java & .NET. There are several approaches to do this - among them wrapping the class as a service, using some interop voodoo, or duplicating the code to both C# & java.
Do you know an out-of-the-box tool that accomplishes the latter - takes a simple C# class with no dependencies and converts it to an equivalent java class?
IKVM.NET does pretty good job in taking a jar file and compiling it to a managed .NET assembly.
If it is small (or in fact, even if it is large), I'm not sure of the wisdom of mechanical translation tools; I've simply never had much joy with them. However, one option would be to write the .NET code in J#.
But I stress - if it was me, I'd manually port it between the two manually and maintain them separately. Most of the time the differences aren't huge - signed bytes, the boxing differences, etc. Of course, anything with delegates will need changing - and captured variables work differently, etc etc.
There used to be a COM bridge and you can register C# assemblies for use in COM with regasm.exe or visual studio.
It's not really what you asked for, but I would just create a simple C# to Java translator.
The differences are not that huge and you seem to be the author of the source so you can avoid nasty constructs that are quite difficult to translate. That way your translator would be quite simple. I would go from C# to Java because C# is more expressive, and you can emulate almost all the C# functions in Java.
Actually cs2java seems to do just that.
This is list of tools I know. Sharpen or j2cstranslator looks like good options.