0

如何在 XSD 文件中强制在代码级别始终以大写形式获取任何字符串变量?

为了实现这一点,我在 Designer.cs 文件中的变量的 get 属性中进行了更改,因为该变量在应用程序中的多个位置使用并且希望进行最小的更改。据我所知,这不是进行更改的正确位置。

早期代码:

public string UserCode { get; set; }

修改后的代码:

private string usercode;

public string UserCode 
        {
            get
            {
                usercode.ToUpperInvariant();
            }
            set { usercode = value; }
        }

谁能知道我们如何在不更改designer.cs文件的情况下做到这一点?

4

1 回答 1

0

试试看:

class Program.cs

private UserCode m_UserCode;
public UserCode userCode { get { return m_SpUniqueId; } }

而不是你想要的功能,你可以做:

m_UserCode = userCode.ToUpperInvatiant();

注意,我还没有测试过,但我认为这应该可以完成你的工作。

于 2014-12-23T08:04:09.660 回答