Congratulations to all the winners of April 2013, they have won INR 3400 cash and INR 20147 worth prizes !
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 31752 |  Welcome, Guest!   Register  Login
 Home > Code Snippets > C# > Convert C# Method Names to Java Style using CodePorting App ...
Zarfishan

Convert C# Method Names to Java Style using CodePorting App

 Code Snippet posted by: Zarfishan | Posted on: 7/2/2012 | Category: C# Codes | Views: 343 | Status: [Member] | Points: 40 | Alert Moderator   


In my previous blog post, I explained the conversion of code formatting with the help of an example. Today I will be explaining about conversion of C# method names and other code formatting to java that can be achieved by using CodePorting C#2Java Application.

Using CodePorting you can import your .Net Project directly from your repository, instantly convert it to java and download it or export it back to your favorite repository. CodePorting has made it very easy to access your online repositories without leaving the Codeporting Environment and it also supports version control systems like Git, Subversion, Mercurial (hg).

Lets take an example of code formatting conversion:

C# Code:


namespace CsPorter.Examples.Formatter
{

public class Test16
{
void Method(float f1, float f2,float f3)
{
float ff = f1 + f2;
ff = f1 + f2 - f3 * ff / f1;
double d = f1 + f2 * f3;
d = ff*ff + 42f;
ff = f1/2 + (float) d;
f1 = MethodF(f1 + f2*f3);
f1 = MethodF(f1 + f2*f3)*f1 + f2;
ff = f1 * (FX - FX);
}

float MethodF(float f)
{
return 42f * f;
}

float FX { get { return 42f; } }
}
}
Java Code:

package CsPorter.Examples.Formatter;

// ********* THIS FILE IS AUTO PORTED FORM C# USING CODEPORTING.COM *********

public class Test16
{
private void method(float f1, float f2,float f3)
{
float ff = f1 + f2;
ff = f1 + f2 - f3 * ff / f1;
double d = f1 + f2 * f3;
d = ff*ff + 42f;
ff = f1/2 + (float) d;
f1 = methodF(f1 + f2*f3);
f1 = methodF(f1 + f2*f3)*f1 + f2;
ff = f1 * (getFX() - getFX());
}

private float methodF(float f)
{
return 42f * f;
}

private float getFX() { return 42f; }


In the above example it is clear that C# method names have been converted to Java style method names and same goes for getter names.
Found interesting? Add this to:


>> Write Response - Respond to this post and get points

More codes snippets

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/18/2013 8:32:54 AM