Answers for "extension of c# file"

C#
1

c# get file extension

string myFilePath = @"C:MyFile.txt";
string ext = Path.GetExtension(myFilePath);
// ext would be ".txt"
Posted by: Guest on August-11-2020
0

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

C# Answers by Framework

Browse Popular Code Answers by Language