CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2002
    Location
    Australia
    Posts
    207

    [RESOLVED] case sensitive issue

    Hi,

    I am getting an object property based on the variable i passed in, however, i found the case sensitive issue caused the property cannot be found.

    e.g., there is a property call RoleID, the value from the variable is ROLEID. The result will be null since the case different. Do you have any idea i can fix the code below to ignore the case?

    PropertyInfo lPropInfo = (pTargetObj.GetType()).GetProperty(lP2.lPName.Replace("@", ""));


    Many Thanks

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: case sensitive issue

    Well you could stroe it in a varibale and convert the case of the characters, I suppose that would be ok if this were the only instance but I imagion it is not.

    You could use VB.Net which is not case sensitive.
    Always use [code][/code] tags when posting code.

  3. #3
    Join Date
    Oct 2002
    Location
    Australia
    Posts
    207

    Re: case sensitive issue

    Thank you for your reply, the situation does not allow me to use VB.NET. anyway i've found the solution for this,


    PropertyInfo lPropInfo = (pTargetObj.GetType()).GetProperty(lPram.ParameterName.Replace("@", ""), ,BindingFlags.SetProperty | BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance);


    Hope that will help other C# developers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured