Click here to Skip to main content
       

Press Releases

Welcome to the new Press Releases forum! Our old press release system has been retired but we've moved everything and everyone to a new, shinier home. Enjoy!

A press release must be written for the purpose of announcing something newsworthy. Advertisements, promotions, or anything smelling even vaguely of spam will be deleted. All press releases must be relevant to the development community.

 
You must Sign In to use this message board.
Search this forum  
GeneralCodePorting Converts C# Delegates to Java Instantly Pin
Thursday, September 27, 2012 12:26 AM by codeporting
CodePorting C#2Java Application is a cloud based converter that has accomplished immense popularity because of its broad collection of supported C# language constructs. Its powerful engine parse and transforms thousand of C# souce code lines to java in few seconds.
CodePorting has recently imrpoved its C#2Java engine and now its capable of converting C# source code having delegates in it to java. In C# programming language, delegate is a form of type-safe function pointer which is mostly used for call backs and event listener. Unfortunately, there is no delegate construct in Java so while converting C# code to Java, C#2Java engine intelligently converts the delegates to interfaces with the invoke method call by auto generating required code.
 
Lets take an example of how codeporting engine converts C# delegates to java interfaces.
 
C# Code:
 
using System.Collections.Generic;
using System;
using System.Linq;
public class Delegate
{
public static void Main(string[> arg)
{

Del handler = DelegateMethod;

// Call the delegate.
handler("Hello World");

}
public delegate void Del(string message);

public static void DelegateMethod(string message)
{
Console.WriteLine(message);

}
}
Java Code:
 
// ********* THIS FILE IS AUTO PORTED FROM C# USING CODEPORTING.COM *********

public class Delegate
{
public static void main(String[> arg)
{

Del handler = new Del() {
public void invoke(String message) {
delegateMethod(message);
}};

// Call the delegate.
handler.invoke("Hello World");

}
public interface Del{
void invoke(String message);
}

public static void delegateMethod(String message)
{
System.out.printf(message);

}
}
 
Newly added articles and documentation pages
 
- CodePorting Converts C# Delegates to Java Instantly[/url
- CodePorting has
converted more than 5 Million lines of C# code to Java
- Convert C# is Operator to instanceof Operator in Java
- List of Conversions Supported by CodePorting C#2Java Engine
 
About CodePorting C#2Java App
 
CodePorting helps you make your .NET applications cross platform compatible and allows migrating your .NET solutions, projects and files into Java in the cloud. Other than speed and accuracy of conversion; port your C# code directly either by uploading .cs files contained in a .zip file or import directly from popular version control repositories like GIT, Mercurial HG and SubVersion. You can also download a Microsoft Visual Studio plugin and convert C# code in the real time without leaving the development environment. You may also build your own customized code conversion applications using CodePorting APIs.
 
Read more about CodePorting
 
- Start converting C# Apps and source code to Java
- CodePorting Homepage
- CodePorting C#2Java Homepage
- CodePorting Documentation
- Watch out CodePorting introductory video
 

Contact Us
 
Suite 163, 79 Longueville Road
Lane Cove, NSW 2066, Australia
Codeporting – Your CodePorting Experts
Skype Name: CodePorting
Email: support [@] codeporting [dot] com

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 24 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid