topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday April 25, 2024, 6:35 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Convert between C# and Java with CSharpJavaMerger  (Read 3696 times)

sindy55

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 2
    • View Profile
    • Donate to Member
Convert between C# and Java with CSharpJavaMerger
« on: September 17, 2009, 01:44 AM »
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....harp-java-conversion

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,901
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Convert between C# and Java with CSharpJavaMerger
« Reply #1 on: September 17, 2009, 01:56 PM »
Now that's interesting!  Is this your creation sindy, or just something you came across? looks pretty cool.

sindy55

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 2
    • View Profile
    • Donate to Member
Re: Convert between C# and Java with CSharpJavaMerger
« Reply #2 on: September 20, 2009, 10:19 PM »
I came across this :). If you're interested, you can join the project too. It is also available at CodePlex:
http://csharpjavamerger.codeplex.com/

Cheers.

jeremejazz

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 59
  • hey!
    • View Profile
    • Personal Website
    • Donate to Member
Re: Convert between C# and Java with CSharpJavaMerger
« Reply #3 on: October 21, 2009, 09:51 AM »
whoah.. now this is very interesting...  hybrid programming eh?

since the two languages are related, you can merge their source codes...