-
February 28th, 2012, 10:00 PM
#1
[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
-
February 29th, 2012, 12:24 AM
#2
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.
-
February 29th, 2012, 12:27 AM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|