//I have this method that use dynamic public static dynamic Fact(dynamic r) { dynamic result = 1; for (dynamic i = 1; i <= r; i++) { result *= i; } return result; } //I call it in main as static void Main(string[] args) { for (int i = 9; i < 100; i++) { dynamic x=helper_method.Fact(i); Console.WriteLine("{0}\t>>{1}\t{2}", i, x,x.GetType()); } } //the output type is Int32 at all //I think since it is dynamic the type will changed when match maximum int32 //and dynamic will automatically change type Int32 to Int64 //what is the benefit of dynamic if it's type not changed at runtime????????? //output here /* 9 >>362880 System.Int32 10 >>3628800 System.Int32 11 >>39916800 System.Int32 12 >>479001600 System.Int32 13 >>1932053504 System.Int32 14 >>1278945280 System.Int32 15 >>2004310016 System.Int32 16 >>2004189184 System.Int32 17 >>-288522240 System.Int32 18 >>-898433024 System.Int32 19 >>109641728 System.Int32 20 >>-2102132736 System.Int32 21 >>-1195114496 System.Int32 22 >>-522715136 System.Int32 23 >>862453760 System.Int32 24 >>-775946240 System.Int32 25 >>2076180480 System.Int32 26 >>-1853882368 System.Int32 27 >>1484783616 System.Int32 28 >>-1375731712 System.Int32 29 >>-1241513984 System.Int32 30 >>1409286144 System.Int32 31 >>738197504 System.Int32 32 >>-2147483648 System.Int32 33 >>-2147483648 System.Int32 34 >>0 System.Int32 35 >>0 System.Int32 36 >>0 System.Int32 37 >>0 System.Int32 38 >>0 System.Int32 39 >>0 System.Int32 40 >>0 System.Int32 41 >>0 System.Int32 42 >>0 System.Int32 43 >>0 System.Int32 44 >>0 System.Int32 45 >>0 System.Int32 46 >>0 System.Int32 */
result=1
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)