Home › Forums › C# Programming › Convert between C# and Java with CSharpJavaMerger
- This topic has 1 reply, 2 voices, and was last updated 13 years, 4 months ago by GrantFinej.
- September 10, 2009 at 6:30 am #2231PaulettMcgrathMember
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()
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);
CString strSaveResult = new CString(strValue1.GetValue() + ” + ” + strValue2.GetValue() + ” = ” + strShowResult.GetValue() + “n”);
catch (Exception ee)
m_mainForm.SaveResult(new CString(ee.Message + “n”));
More info on CSharpJavaMerger: http://www.kevingao.net/csharp-java-conversion
- January 21, 2010 at 6:09 am #3612GrantFinejParticipant
Thanks for the information.
- The forum ‘C# Programming’ is closed to new topics and replies.