Click here to Skip to main content
15,889,723 members
Home / Discussions / C#
   

C#

 
QuestionCreate JSON object from string Pin
WillyBilly9030-May-18 10:27
WillyBilly9030-May-18 10:27 
AnswerRe: Create JSON object from string Pin
Mycroft Holmes30-May-18 14:17
professionalMycroft Holmes30-May-18 14:17 
GeneralRe: Create JSON object from string Pin
WillyBilly9031-May-18 9:57
WillyBilly9031-May-18 9:57 
AnswerRe: Create JSON object from string Pin
Richard Deeming31-May-18 10:08
mveRichard Deeming31-May-18 10:08 
GeneralRe: Create JSON object from string Pin
WillyBilly901-Jun-18 8:13
WillyBilly901-Jun-18 8:13 
QuestionReflect Generic Property Info Pin
Kevin Marois30-May-18 7:19
professionalKevin Marois30-May-18 7:19 
AnswerRe: Reflect Generic Property Info Pin
Gerry Schmitz30-May-18 9:46
mveGerry Schmitz30-May-18 9:46 
AnswerRe: Reflect Generic Property Info Pin
Richard Deeming30-May-18 9:51
mveRichard Deeming30-May-18 9:51 
Slightly tricky to follow, since your generic type parameters seem to be missing from your code blocks.

Assuming PropertyModel is not generic, and the value is an object, you probably need to have a non-generic interface to read the value. For example:
C#
interface ISetting
{
    object CurrentValue { get; }
}

class Setting<T> : _EntityBase, ISetting
{
    ISetting.CurrentValue => CurrentValue.Value;
    ...
}

...

foreach (PropertyInfo propertyInfo in propertyInfos)
{
    var settingProperty = (ISetting)propertyInfo.GetValue(Setting);
    var model = new PropertyModel(propertyInfo.Name, settingProperty.CurrentValue);
    Properties.Add(model);
}


NB: If you'd rather avoid writing your own property grid, there's one included with the free version of the Extended WPF Toolkit:
PropertyGrid · xceedsoftware/wpftoolkit Wiki · GitHub[^]



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: Reflect Generic Property Info Pin
Eddy Vluggen30-May-18 10:23
professionalEddy Vluggen30-May-18 10:23 
GeneralRe: Reflect Generic Property Info Pin
Kevin Marois30-May-18 10:30
professionalKevin Marois30-May-18 10:30 
GeneralRe: Reflect Generic Property Info Pin
Kevin Marois31-May-18 11:20
professionalKevin Marois31-May-18 11:20 
GeneralRe: Reflect Generic Property Info Pin
Richard Deeming31-May-18 11:52
mveRichard Deeming31-May-18 11:52 
QuestionUnable to connect to remote server error in iis express Pin
galba201830-May-18 3:07
galba201830-May-18 3:07 
AnswerRe: Unable to connect to remote server error in iis express Pin
Pete O'Hanlon30-May-18 5:31
mvePete O'Hanlon30-May-18 5:31 
GeneralRe: Unable to connect to remote server error in iis express Pin
galba201830-May-18 20:10
galba201830-May-18 20:10 
QuestionGet Outlook email attachments Pin
Raghu Kiran29-May-18 16:23
Raghu Kiran29-May-18 16:23 
AnswerRe: Get Outlook email attachments Pin
Pete O'Hanlon29-May-18 22:36
mvePete O'Hanlon29-May-18 22:36 
AnswerRe: Get Outlook email attachments Pin
Richard MacCutchan29-May-18 22:36
mveRichard MacCutchan29-May-18 22:36 
Questionuser contrôle with entity frameworks Pin
Yassine Soutsan28-May-18 3:29
Yassine Soutsan28-May-18 3:29 
AnswerRe: user contrôle with entity frameworks Pin
Dave Kreskowiak28-May-18 6:09
mveDave Kreskowiak28-May-18 6:09 
AnswerRe: user contrôle with entity frameworks Pin
User 418025429-May-18 2:02
User 418025429-May-18 2:02 
GeneralRe: user contrôle with entity frameworks Pin
Gerry Schmitz29-May-18 7:26
mveGerry Schmitz29-May-18 7:26 
QuestionMD file Pin
Member 1384619127-May-18 5:30
Member 1384619127-May-18 5:30 
AnswerRe: MD file Pin
Dave Kreskowiak27-May-18 6:17
mveDave Kreskowiak27-May-18 6:17 
AnswerRe: MD file Pin
OriginalGriff27-May-18 6:27
mveOriginalGriff27-May-18 6:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.