Skip to main content

Posts

Showing posts with the label ASP.NET MVC

Introduction to Generic Methods in C#

When we create a method, class or interface, we usually specify the type of the parameter and its return type. Ex. C# 1 2 3 4 5 6 7 8          private void showValue ( int val )      {          MessageBox . Show ( val . ToString ( ) ) ;      }     Invoke the above function using C# 1 2 3 4 5          showValue ( 10 ) ;    // 10 displyed in message box     This will display 10 in the message box. Now pass the  string  to the  showValue  function as shown below and you will get the compiler error  “Invalid arguments”  . That is because showValue function expects an integer and not a string; C# 1 2 3 4 5   ...