Answers for "extension of c sharp"


define extension methods c#

public static class MyExtensions
  //use the this keyword before an argument
  public static int WordCount(this String str)
    return str.Split(new char[] { ' ', '.', '?' },
Posted by: Guest on July-25-2020

c# 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();
Posted by: Guest on August-23-2020

extension of c sharp

static void main(string[] args)
    int num1 = 125;
    int num2 = 12.5;
    int num3 = num1/num2
Posted by: Guest on October-10-2021

C# Answers by Framework

Browse Popular Code Answers by Language