为什么AppDomainSetup.ShadowCopyFiles一个字符串? [英] Why is AppDomainSetup.ShadowCopyFiles a string?

查看:438
本文介绍了为什么AppDomainSetup.ShadowCopyFiles一个字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文档

一个包含字符串值true,表明影子复制字符串被开启;或假以指示影子复制是关闭的。

A String containing the string value "true" to indicate that shadow copying is turned on; or "false" to indicate that shadow copying is turned off.

和自1.1其都是这样。 ?任何人都可以摆脱任何光线

And its been this way since 1.1. Can anyone shed any light?

我reflector'd良好的措施getter和setter:

I reflector'd the getter and setter for good measure:

public string ShadowCopyFiles
{
    get
    {
        return this.Value[8];
    }
    set
    {
        if ((value != null) && (string.Compare(value, "true", StringComparison.OrdinalIgnoreCase) == 0))
        {
            this.Value[8] = value;
        }
        else
        {
            this.Value[8] = null;
        }
    }
}

//The referenced Value property...

internal string[] Value
{
    get
    {
        if (this._Entries == null)
        {
            this._Entries = new string[0x10];
        }
        return this._Entries;
    }
}

private string[] _Entries; 



所以,也许阵列相生更容易拷贝构造函数或东西吗?

So maybe the Value array begets an easier copy constructor or something?

推荐答案

缺少咖啡因。有些东西是注定不会被理解。

Lack of caffeine. Some things are not meant to be understood.

这显然似乎是从.NET第一个版本,而不是固定的,因为这可以打破传统的代码错误。

This clearly seems to be a mistake from .NET first version, not fixed because that could break "legacy" code.

天哪,我刚刚发现这一点:

Gosh, I just found this:

您在.NET反馈谢谢框架!我们认为这是一个疏忽,而且物业类型应该是一个布尔值。然而,这是相当困难的(如果不是不可能的),以使在向后兼容的版本(如逆戟鲸)这一变化,因为我们打破任何客户依靠字符串比较的代码。所以,很遗憾,我们必须权衡破坏兼容性与API清洁的好处的风险... ...当它涉及到最好的支持我们的客户群,前者通常获胜。我们将在内部跟踪这是一件好事,以改善我们会继续考虑在将来的版本。

Thanks for your feedback on the .NET Framework! We agree that this is an oversight and that the property type should be a boolean. However, it is quite difficult (if not impossible) to make this change in a backwards compatible release (such as Orcas), because we would break the code of any customer relying on string comparisons. So unfortunately we must weigh the risk of breaking compatibility vs. the benefits of API cleanliness...and when it comes to best supporting our customer base, the former typically wins. We will track this internally as a good thing to improve and we'll continue to consider it in future releases.

从的这里

这篇关于为什么AppDomainSetup.ShadowCopyFiles一个字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆