0

How can I enforce in the XSD file to get any string variable always in UPPER case at code level?

To implement this I've done changes in the designer.cs file in the get property of the variable because this variable is used at number of places in the application and wanted to do minimal changes. As far I know this is not a right place to done changes.

Earlier Code:

public string UserCode { get; set; }

Modified code:

private string usercode;

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

Could anyone have any idea how can we do this without changing designer.cs file?

Geeky Ninja
  • 6,002
  • 8
  • 41
  • 54

1 Answers1

0

Try that:

class Program.cs

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

And than in your desired function you could do:

m_UserCode = userCode.ToUpperInvatiant();

Note, I have not tested it but I think this should do your work.

Luca
  • 1,766
  • 3
  • 27
  • 38
  • But, in this case if variable m_UserCode is using at say 100 places in code then I need to modify it at 100 places. Which I don't want to do it. – Geeky Ninja Dec 23 '14 at 09:21
  • then you can still do it in the designer.cs if you want. But afaik there is no other option thats in my mind – Luca Dec 23 '14 at 09:27
  • Problem is updation in design.cs are not consider as good approach. Thats why I am trying to find out the best way to do it. – Geeky Ninja Dec 24 '14 at 07:33