C#类拓展方法
要求:
扩展方法类必须为静态类;
拓展方法必须为静态方法,参数为this+需拓展类对象;
多个类拓展方法可以写在一个拓展类中;
public class TestExtension{public string Test1(){return "test";}}public static class MyExtension{public static void Show(this TestExtension obj){Debug.Log("ExtensionFunc:"+ obj.Test1());}}
调用:
TestExtension ts = new TestExtension();ts.Show();
爱站程序员基地
![(原创)[C#] 一步一步自定义拖拽(Drag&Drop)时的鼠标效果:(一)基本原理及基本实现-爱站程序员基地](https://aiznh.com/wp-content/uploads/2022/07/20220721231016-62d9dcd85c40b-220x150.gif)

