Convert between C# and Java with CSharpJavaMerger

Posted by Sindy55 under C# on 10/21/2009 | Views : 1306 | Status : [Member] | Replies : 2
CSharpJavaMerger is an open source tool. It provides common interfaces of C# and Java and enables you to write one set of code which can be used both by C# and Java.

Below is a method that can be used in both of C# and Java. In the sample, CString is a class defined in the CSharpJavaMerger Framework.

public void AddTwoValues()
{
try
{
CString strValue1 = m_mainForm.GetFirstTextBoxValue();
CString strValue2 = m_mainForm.GetSecondTextBoxValue();

int iValue1 = strValue1.ToInteger();
int iValue2 = strValue2.ToInteger();
int iResult = iValue1 + iValue2;
CString strShowResult = CString.ValueOf(iResult);
m_mainForm.ShowResult(strShowResult);
CString strSaveResult = new CString(strValue1.GetValue() + " + " + strValue2.GetValue() + " = " + strShowResult.GetValue() + "\n");
m_mainForm.SaveResult(strSaveResult);
}
catch (Exception ee)
{
m_mainForm.SaveResult(new CString(ee.Message + "\n"));
m_mainForm.ShowResult(new CString("Error"));
}
}


More info on CSharpJavaMerger: http://www.kevingao.net/csharp-java-conversion




Responses

Posted by: Zarfishan on: 5/16/2012 [Member] Starter | Points: 25

Up
0
Down
You may use Codeporting c# java converter to port you c# code to java. Its a cloud based Application and free to use.

Sindy55, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 10/23/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
This is not a Question. Please Post this in the Codes Section. i will move it there later today.

Thank you for posting at Dotnetfunda


Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Sindy55, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response