zoukankan      html  css  js  c++  java
  • What is base..ctor(); in C#?

    I am disassembling some C# applications and I am trying to reconstruct the source code. I am disassembling the application along with the required DLLs.
    I keep coming across this line base..ctor(); which gives me an error. The line occurs in some voids with in some subclasses of Stream and Exception.

    Does anyone have any idea what the code should be? I am thinking the disassembler messed it up some how and it is clearly invalid code. So does anyone know what it is meant to mean and how I can change the line so it works?

    Here is the code of one of the subclasses that line occurs in:

    [Guid("ebc25cf6-9120-4283-b972-0e5520d0000E")]
    public class ZlibException : Exception
    {
        public ZlibException()
        {
            base..ctor();
            return;
        }
    
        public ZlibException(string s)
        {
            base..ctor();
            return;
        }
    }

    It should be :

    [Guid("ebc25cf6-9120-4283-b972-0e5520d0000E")]
    public class ZlibException : Exception
    {
        public ZlibException() : base()
        {
            return;
        }
    
        public ZlibException(string s) : base()
        {
            return;
        }
    }

    Which calls the constructor with that signature on the base implementation of this class.

    But by default the .NET CLR calls the base, blank constructor for you, so you don't actually need the : base()

     原文地址:http://stackoverflow.com/questions/18150628/what-is-base-ctor-in-c

  • 相关阅读:
    南邮NOJ整除的尾数
    【HDOJ】2844 Coins
    【HDOJ】2546 饭卡
    【HDOJ】1031 Design T-Shirt
    【HDOJ】1983 Kaitou Kid
    【HDOJ】2612 Find a way
    【原创】如何构建MIPS交叉编译工具链
    【HDOJ】1239 Calling Extraterrestrial Intelligence Again
    【Python Network】使用DOM生成XML
    【HDOJ】2602 Bone Collector
  • 原文地址:https://www.cnblogs.com/landv/p/6670972.html
Copyright © 2011-2022 走看看