前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >What is base..ctor(); in C#?

What is base..ctor(); in C#?

作者头像
landv
发布2018-05-24 16:15:48
6040
发布2018-05-24 16:15:48
举报
文章被收录于专栏:landv

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:

代码语言:javascript
复制
[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 :

代码语言:javascript
复制
[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

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2017-04-05 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档