summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLaoujin <woutervs@hotmail.com>2015-01-31 21:41:46 +0100
committerLaoujin <woutervs@hotmail.com>2015-01-31 21:41:46 +0100
commit69e38974aec4d149944e551867c1412dfcf2bed7 (patch)
tree8b720a9085cccbcdf30e930d1d0396e6ca902495
parent495e38612160ac373325543de3c5b88e0ef6ed35 (diff)
[CSharp/en]added casting to converting
-rw-r--r--csharp.html.markdown7
1 files changed, 6 insertions, 1 deletions
diff --git a/csharp.html.markdown b/csharp.html.markdown
index 9f66b8ff..fceda4ff 100644
--- a/csharp.html.markdown
+++ b/csharp.html.markdown
@@ -310,7 +310,7 @@ on a new line! ""Wow!"", the masses cried";
// Converting data
// Convert String To Integer
- // this will throw a Exception on failure
+ // this will throw a FormatException on failure
int.Parse("123");//returns an integer version of "123"
// try parse will default to type default on failure
@@ -324,6 +324,11 @@ on a new line! ""Wow!"", the masses cried";
Convert.ToString(123);
// or
tryInt.ToString();
+
+ // Casting
+ // Cast decimal 15 to a int
+ // and then implicitly cast to long
+ long x = (int) 15M;
}
///////////////////////////////////////