Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Comparison of C Sharp and Java
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Integration of library-defined types === C# allows library-defined types to be integrated with existing types and operators by using custom implicit/explicit conversions and operator overloading as illustrated by the following example: {| style="width:100%;" class="wikitable" |- ! style="width:50%;"|Java !! style="width:50%;"| C# |- | <syntaxhighlight lang=Java style="font-size:90%"> var bigNumber = new BigInteger("123456789012345678901234567890"); var answer = bigNumber.multiply(BigInteger.valueOf(42)); var square = bigNumber.sqrt(); var sum = bigNumber.add(bigNumber); </syntaxhighlight> | <syntaxhighlight lang="csharp" style="font-size:90%"> var bigNumber = BigInteger.Parse("123456789012345678901234567890"); var answer = bigNumber * 42; var square = bigNumber * bigNumber; var sum = bigNumber + bigNumber; </syntaxhighlight> |}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)