zoukankan      html  css  js  c++  java
  • Reflector反编译结果的T?相对应的为Nullable(Of T)

        1、用Reflector反编译时,有时候会产生T?,这时候可用Nullable(Of T)代替,通过HasValue来判断是否有值,而Value能获取T的值。

        2、用Reflector反编译时,有时候会产生

        Try
            ...
        Catch X As Object
            ...
        End Try

        这时候应该用Exception代替Object,表示异常。

        3、用Reflector反编译时,有时候会产生

        Public Custom Event X As EventHandler
            AddHandler(ByVal value As EventHandler)
                Dim handler2 As EventHandler
                Dim x As EventHandler = Me.X
                Do
                    handler2 = x
                    Dim handler3 As EventHandler = DirectCast(Delegate.Combine(handler2, value), EventHandler)
                    x = Interlocked.CompareExchange(Of EventHandler)((Me.X), handler3, handler2)
                Loop While (Not x Is handler2)
            End AddHandler
            RemoveHandler(ByVal value As EventHandler)
                Dim handler2 As EventHandler
                Dim x As EventHandler = Me.X
                Do
                    handler2 = x
                    Dim handler3 As EventHandler = DirectCast(Delegate.Remove(handler2, value), EventHandler)
                    x = Interlocked.CompareExchange(Of EventHandler)((Me.X), handler3, handler2)
                Loop While (Not x Is handler2)
            End RemoveHandler
        End Event

         Private X As EventHandler

        这时候应该用去掉Custom,并删除AddHandler和RemoveHandler两个过程,以及声明。

        4、用Reflector反编译时,有时候会产生

        Public Property X As Integer
            Get
            Set (ByVal value As Integer)
        End Property

        <CompilerGenerated> _
        Private <X>k__BackingField As Integer

        这时候应该删除Get和Set语句,并删除编译产出的变量声明,或者补足Get和Set语句。

  • 相关阅读:
    [转]按照HashTable动态设定类的属性和字段
    Enterprise Library 3.0 January 2007 CTP 数据访问程序块 _ 图解配置
    用Ad和windsor重构Portal
    ActiveRecordBase借助NHibernate的条件获取实体类对象
    Enterprise Library 3.0 January 2007 CTP 数据访问程序块 _ 系统自带链接字符串加密
    VS2005 SP1时因为安全策略而安装失败!
    [转]ASP.NET 2.0 的内部变化
    VB.NET 实现动态数组
    Making plain binary files using a C compiler (i386+)
    迭代器的使用方法简要介绍(摘自C++Primer)
  • 原文地址:https://www.cnblogs.com/tulife/p/2217693.html
Copyright © 2011-2022 走看看