CodePorting Provides a cloud based conversion service to help users to automatically translate their source code from C# to Java using C#2Java Engine and because it is a web-based application that makes it platform, operating system and browser independent. You just need a browser and internet connection, no installation is required just Sign In and start converting your code from C# to java. You can also edit your .Net code on the fly and download your converted code from anywhere , anytime.

In my previous blog I showed you how CodePorting Engine converts Comments while translating C# code to java. This week I am going to show you how can convert C# “is” operator to java “instanceof” operator using Codeporting‘s cloud based App.

An ´is´ expression returns true if following conditions are met:

  • expression is not null
  • expression can be cast to type

 

Following Example shows how “is” operator will be converted to “instanceof” operator after the conversion.

C# Code:

 

namespace CsPorter.Examples.Convert.LanguageConstructs.AsIs

{

    public class Example1

    {

        void Method()

        {

            object obj = null;

            bool b = obj is string;

            b = b is object ? true : false;

        }

    }

}

Java Code:

 

package CsPorter.Examples.Convert.LanguageConstructs.AsIs;

 

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

 

public class Example1

{

    private void method()

    {

        Object obj = null;

        boolean b = obj instanceof String;

        b = (Object)b instanceof Object ? true : false;

    }

}

 

It is clear from the above example that Codeporting Engine automatically convert “is” operator to “instanceof” operator generating the same result.

Newly added articles and documentation pages

About CodePorting C#2Java App

CodePorting helps you make your .NET applications cross platform compatible and allows migrating your .NET solutions, projects and files into Java in the cloud. Other than speed and accuracy of conversion; port your C# code directly either by uploading .cs files contained in a .zip file or import directly from popular version control repositories like GIT, Mercurial HG and SubVersion. You can also download a Microsoft Visual Studio plugin and convert C# code in the real time without leaving the development environment. You may also build your own customized code conversion applications using CodePorting APIs.

Read more about CodePorting

Contact Us

Suite163,79 Longueville Road

Lane Cove, NSW 2066,Australia

CodePorting Your CodePorting Experts

Skype Name: CodePorting

Email: support [@] codeporting [dot] com