【问题标题】:can you write extension methods on type arrays?你能在类型数组上写扩展方法吗?
【发布时间】:2010-09-19 21:58:02
【问题描述】:

我需要在 byte[] 上写一个扩展方法。这可能吗?

【问题讨论】:

    标签: c# arrays extension-methods


    【解决方案1】:

    是的,就是这样:

    public static class Extensions
    {
        public static void Method(this byte[] current)
        {
    
        }
    }
    

    【讨论】:

      【解决方案2】:

      当然,只需将第一个参数设为byte[]

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-04-01
        • 1970-01-01
        • 1970-01-01
        • 2012-09-03
        • 2011-10-10
        • 2023-03-21
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多