RuntimePropertyInfo with Special characters (Danish language) RRS feed

  • Question

  • Hi,

    I have a problem with the Danish characters. The GetValue() method returns null on that particular property which name consists of special characters from the Danish language. However, if I remove the special character, then GetValue() works fine. Can anybody help on this please. 

    Wednesday, October 22, 2014 9:39 PM


  • Hello D-Ham,

    I am trying to help look into this case, to help you solve this issue, please help provide information as:

    Is that the string in your provided image is the one which would cause the GetValue() method return null?

    If not, please share the string with the specific character.

    If it is, please share related code with us as how you create the object and how you use reflection API to get the value, because I also make a test as below with the string in the image, however, it could work fine:

    class Program
            static void Main(string[] args)
                #region https://social.msdn.microsoft.com/Forums/en-US/273a68ad-fe73-4b2c-af12-da6650a7d9bd/runtimepropertyinfo-with-special-characters-danish-language?forum=
                TestEntity entity = new TestEntity() { ID = 1, Name = "Forlængetgyldighed" };
                Type type = entity.GetType();
                var properties = type.GetProperty("Name").GetValue(entity);
        public class TestEntity
            public int ID { get; set; }
            public string Name { get; set; }

    And you are working with the Danish language, please also have a try to use the third overwritten GetValue method which needs a specific cultureInfo parameter:

    public abstract Object GetValue(Object obj,BindingFlags invokeAttr,Binder binder,Object[] index,CultureInfo culture)


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Fred Bao Friday, October 31, 2014 8:13 AM
    • Marked as answer by Fred Bao Monday, November 3, 2014 8:30 AM
    Thursday, October 23, 2014 2:19 AM