Developer's Blog
Register Low Fi Mark Forums Read

Reply
 
Thread Tools
Old 10-29-2009, 07:29 AM   #1
sindy55
Member
 
Join Date: Oct 2009
Posts: 1
sindy55 is offline

Default Achieve interoperability between C# and Java with


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.

Code:
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: C# & Java interoperability
  Reply With Quote
Old 10-29-2009, 11:32 AM   #2
XaTrIxX
Forum Staff
 
XaTrIxX's Avatar
 
Join Date: Jun 2009
Posts: 2,669
Blog Entries: 3
XaTrIxX is offline
Default Re: Achieve interoperability between C# and Java w

This is your first post in this forum, and I kinda think that this is meant to be just advertisement. I generally got no problem with this, but it should really be a discussion. I won't close it for now. I just let you know.
__________________

Programming section moderator.
Playing DotA since 2005.
  Reply With Quote
Reply
  Entertainment Programming


Forum Jump

Thread Tools