Convert C# is Operator to instanceof Operator in Java
1 posts in topic
Thread View Thread View
TOPIC ACTIONS:
 

Convert C# is Operator to instanceof Operator in J...
zarfishan
Sun Jun 24, 2012 09:04 PM

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.

  CodePorting is a cloud bas...

raja
Fri Feb 01, 2013 03:48 AM

CodePorting is a cloud based code migration service, dedicated to help it’s users to automatically port their source code from C# to Java by using the state of the art C#2Java porting engine. It’s web-based architecture makes it platform, operating system and browser independent. All you need is a browser and an Internet connection, and you are good to go. No installation required: just sign in and start converting. You can make quick fixes to your .NET code on the fly and download the ported Java code anywhere, any time.



Packers and Movers in Chennai
http://www.chennaipackersmovers.com/

About | Sitemap | Contact