1. <tfoot id='cHuti'></tfoot>

        <bdo id='cHuti'></bdo><ul id='cHuti'></ul>
    2. <small id='cHuti'></small><noframes id='cHuti'>

      <legend id='cHuti'><style id='cHuti'><dir id='cHuti'><q id='cHuti'></q></dir></style></legend>

      1. <i id='cHuti'><tr id='cHuti'><dt id='cHuti'><q id='cHuti'><span id='cHuti'><b id='cHuti'><form id='cHuti'><ins id='cHuti'></ins><ul id='cHuti'></ul><sub id='cHuti'></sub></form><legend id='cHuti'></legend><bdo id='cHuti'><pre id='cHuti'><center id='cHuti'></center></pre></bdo></b><th id='cHuti'></th></span></q></dt></tr></i><div id='cHuti'><tfoot id='cHuti'></tfoot><dl id='cHuti'><fieldset id='cHuti'></fieldset></dl></div>

        DefaultValue 属性不适用于我的自动属性

        时间:2023-07-27
            <bdo id='IuwE6'></bdo><ul id='IuwE6'></ul>
            <tfoot id='IuwE6'></tfoot>

                <tbody id='IuwE6'></tbody>
              <i id='IuwE6'><tr id='IuwE6'><dt id='IuwE6'><q id='IuwE6'><span id='IuwE6'><b id='IuwE6'><form id='IuwE6'><ins id='IuwE6'></ins><ul id='IuwE6'></ul><sub id='IuwE6'></sub></form><legend id='IuwE6'></legend><bdo id='IuwE6'><pre id='IuwE6'><center id='IuwE6'></center></pre></bdo></b><th id='IuwE6'></th></span></q></dt></tr></i><div id='IuwE6'><tfoot id='IuwE6'></tfoot><dl id='IuwE6'><fieldset id='IuwE6'></fieldset></dl></div>
              <legend id='IuwE6'><style id='IuwE6'><dir id='IuwE6'><q id='IuwE6'></q></dir></style></legend>

                  <small id='IuwE6'></small><noframes id='IuwE6'>

                  本文介绍了DefaultValue 属性不适用于我的自动属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有以下自动属性

                  [DefaultValue(true)]
                  public bool RetrieveAllInfo { get; set; }
                  

                  当我尝试在代码中使用它时,我发现默认 false 是 false 我假设这是 bool 变量的默认值,有人有提示有什么问题!?

                  when I try to use it inside the code i find the default false for is false I assume this is the default value to a bool variable, does anyone have a clue what is wrong!?

                  推荐答案

                  DefaultValue 属性仅用于告诉 Visual Studio 设计人员(例如在设计表单时)属性的默认值是什么.它不会在代码中设置属性的实际默认值.

                  The DefaultValue attribute is only used to tell the Visual Studio Designers (for example when designing a form) what the default value of a property is. It doesn't set the actual default value of the attribute in code.

                  更多信息在这里:http://support.microsoft.com/kb/311339

                  这篇关于DefaultValue 属性不适用于我的自动属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 C# 的属性中使用变量 下一篇:如何让 WinForm Designer 完全忽略自定义控件上的属性?

                  相关文章

                  <small id='YmzFE'></small><noframes id='YmzFE'>

                1. <tfoot id='YmzFE'></tfoot>

                    <i id='YmzFE'><tr id='YmzFE'><dt id='YmzFE'><q id='YmzFE'><span id='YmzFE'><b id='YmzFE'><form id='YmzFE'><ins id='YmzFE'></ins><ul id='YmzFE'></ul><sub id='YmzFE'></sub></form><legend id='YmzFE'></legend><bdo id='YmzFE'><pre id='YmzFE'><center id='YmzFE'></center></pre></bdo></b><th id='YmzFE'></th></span></q></dt></tr></i><div id='YmzFE'><tfoot id='YmzFE'></tfoot><dl id='YmzFE'><fieldset id='YmzFE'></fieldset></dl></div>

                    <legend id='YmzFE'><style id='YmzFE'><dir id='YmzFE'><q id='YmzFE'></q></dir></style></legend>
                      • <bdo id='YmzFE'></bdo><ul id='YmzFE'></ul>