csharp extension

Code Example - csharp extension

                
                        public static class MyClassExtension
{
  // This is the method you are adding to a class "MyClass"
  public static string GetValue(this MyClass myClass)
  {
    return value.toString();
  }
}

// This is how you can use it in other parts of your code
MyClass myClass = new MyClass();
string s = myClass.GetValue();
                    
                
 

extension method csharp

                        
                                // list of useful extension methods
https://www.extensionmethod.net/csharp
https://csharp-extension.com/
                            
                        
 

csharp method info extension

                        
                                private static readonly MethodInfo ExtensionMethod = 
  typeof(ObjectExtensions).GetMethod(nameof(ObjectExtensions.NewMethod));
                            
                        
 

extension of c sharp

                        
                                static void main(string[] args)
{
    int num1 = 125;
    int num2 = 12.5;
    int num3 = num1/num2
    Console.WriteLine(num3)
}