• C# extention extension


    class

       1: public static class 任意类名1
       2: { 
       3:     public static string 任意方法名1(this <T>  plugins,....)
       4:     {
       5:         return "只要命名空间有引用,<T>  的类型能匹配到,这个扩展就可用,真方便";
       6:     }
       7: }

    比如

       1: 1: public static class AnyName
       2: 2: { 
       3: 3:     public static string GetMyName1(this string thisval)
       4: 4:     {
       5: 5:         return "只要命名空间有引用,<T>  的类型能匹配到,这个扩展就可用,真方便";
       6: 6:     }
       7: 7: }
       8: 8:  
       9: 9: string sss = "";
      10: 0: string sss1 = sss.GetMyName1();

    再如

       1: 1: public static class AnyName123
       2: 2: { 
       3: 3:     public static string  Getval(this int thisval)
       4: 4:     {
       5: 5:         return thisval.Tostring();
       6: 6:     }
       7: 7: }
       8: 8:  
       9: 9: int sss = 0;
      10: 0: string  sss1 = sss.Getval();
  • 相关阅读:
    kafka+zookeeper集群部署
    rabbitmq集群部署
    nginx location语法
    rabbitmq单一部署
    Centos6国内可用yum源
    css
    imutable
    js解构复制语法
    redux
    json server问题
  • 原文地址:https://www.cnblogs.com/luckjason/p/2511715.html
Copyright © 2020-2023  润新知