Professional Documents
Culture Documents
1) WAP To Show A Boxing and Un-Boxing of Types
1) WAP To Show A Boxing and Un-Boxing of Types
using System; class prog1 { public static void Main() { int m=100; object o=m; m=200; Console.WriteLine(o); Console.WriteLine(m); int n=(int)o; Console.WriteLine(n); } }
} }
Output: enter the value 123 enter the value 12 34 enter the value 12 1
123 12 34 12 1
output: 6
output: 8 10
output: 5 5 5
List<int> res = values.FindAll(delegate(int element) { if (element > 10) { throw new ArgumentException("element"); } if (element == 8) { throw new ArgumentException("element"); } return element > 1; }); foreach (int val in res) { Console.WriteLine(val); } }catch(ArgumentException a) { Console.WriteLine(a); } } }
output: 31