i am still little confuse.why we write short inside the small braket (short).Can someone tell me why this happens? Clarify Please.
additional why this following code is not working ???.Code:using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace CastingDemo { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { Int16 a= 10; Int32 b= 20; Int16 c; c = (short)(a + b); MessageBox.Show(c.ToString()); } } }
Code:private void Form1_Load(object sender, EventArgs e) { Int16 a= 10; Int32 b= 20; Int32 c; c = (long)(a + b); MessageBox.Show(c.ToString()); }




Reply With Quote