Login
Register
Tutorials
Forum
Career Development
Resources
Reviews
Jobs
Interview
Communities
Projects
Training
Silverlight Games
|
Bookmarks
|
New Members FAQ
|
Mentor
|
Code Converter
|
IT Companies
|
Peer Appraisal
|
Members
|
Revenue Sharing
|
Computer Jokes
|
New Posts
|
Social
|
Talk to Webmaster Tony John
Online Members
srirama
More...
Forums
»
.NET
»
.NET
»
Convert C# “is” Operator to “instanceof” Operator in Java
Posted Date:
24 Jun 2012
Posted By::
Zarfishan
Member Level:
Silver
Member Rank:
1589
Points
: 5
Responses:
9
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.
Tweet
Responses
#677134 Author:
Prachi Kulkarni
Member Level:
Gold
Member Rank:
25
Date: 24/Jun/2012 Rating:
Points
: 1
Hi,
I also found CodePorting very useful.
Regards,
Prachi.
#677135 Author:
Zarfishan
Member Level:
Silver
Member Rank:
1589
Date: 24/Jun/2012 Rating:
Points
: 1
Thanks alot Prachi for praising codeporting's services there are alot of other features which you can use to convert your C# code to java and they are also free.
#677136 Author:
Pawan Awasthi
Member Level:
Diamond
Member Rank:
4
Date: 24/Jun/2012 Rating:
Points
: 1
Hai Zarfishan,
It seems that you wanted to share some article related to 'is' operator in .Net and making the comparison of java.
This is not the right place to share such kind of articles. There is the separate section for it 'Resources' section.
http://www.dotnetspider.com/resources/
Hope it will be helpful to you.
Regards,
Pawan Awasthi(DNS MVM)
+91 8143683708 (pawansoftit@gmail.com)
Outstanding Contribution Award..NTT Data Inc
#677152 Author:
Prachi Kulkarni
Member Level:
Gold
Member Rank:
25
Date: 24/Jun/2012 Rating:
Points
: 1
Hi,
Does CodePorting also convert from Java code to C#? I guess it is not avaiable in CodePorting. Please correct me if I am wrong.
Thanks and regards,
Prachi.
#677189 Author:
Zarfishan
Member Level:
Silver
Member Rank:
1589
Date: 25/Jun/2012 Rating:
Points
: 1
Hi Prachi,
Sorry codeporting does not convert java code to C#.
#677217 Author:
Prachi Kulkarni
Member Level:
Gold
Member Rank:
25
Date: 25/Jun/2012 Rating:
Points
: 1
Hi,
Thanks Zarfishan for the confirmation.
Do you have any idea about any tool which will convert java code to C#?
Regards,
Prachi.
#677222 Author:
Zarfishan
Member Level:
Silver
Member Rank:
1589
Date: 25/Jun/2012 Rating:
Points
: 1
@Prachi i think tangiblesoftwaresolution.com can convert java code to C# i am not sure you can check the site but its not free.
#677229 Author:
Prachi Kulkarni
Member Level:
Gold
Member Rank:
25
Date: 25/Jun/2012 Rating:
Points
: 1
Thanks for the website link!
#677236 Author:
Zarfishan
Member Level:
Silver
Member Rank:
1589
Date: 25/Jun/2012 Rating:
Points
: 1
@Pracihi its http://tangiblesoftwaresolutions.com/ sorry if the first link didnt work.
Post Reply
This thread is locked for new responses. Please post your comments and questions as a
separate thread
.
If required, refer to the URL of this page in your
new post
.
Tweet
Next :
Microsoft Online Exam MCTS-70-515
Previous :
Need code for dropdown in grid
Return to Discussion Forum
Post New Message
Category:
Related Messages
Is there any expert to solve this?
what is difference between String and string(data type) in c#?
what is a resource file...
Horizontal Scroll Bar for a listview control
sql querry
Follow us on Twitter:
https://twitter.com/dotnetspider
Active Members
Today
Pawan Awasthi
(68)
Phagu Mahato
(14)
srirama
(9)
Last 7 Days
baskar
(298)
Pawan Awasthi
(178)
Asheej T K
(173)
more...
Awards & Gifts
Email subscription
.NET Jobs
.NET Articles
.NET Forums
Articles Rss Feeds
Forum Rss Feeds