Click here to Skip to main content
15,918,742 members
Home / Discussions / C#
   

C#

 
AnswerRe: Storing deserialized data into SQL Server Ce using Entity Framework code first Pin
Dave Kreskowiak11-Apr-14 6:59
mveDave Kreskowiak11-Apr-14 6:59 
QuestionToolStripMenuItem color becomes white after clicking Pin
Aaditya Hasiyan10-Apr-14 21:38
Aaditya Hasiyan10-Apr-14 21:38 
QuestionWhat is Lock in C# Pin
Ravindra Bisen10-Apr-14 20:39
Ravindra Bisen10-Apr-14 20:39 
AnswerRe: What is Lock in C# Pin
Peter Leow10-Apr-14 20:44
professionalPeter Leow10-Apr-14 20:44 
AnswerRe: What is Lock in C# Pin
OriginalGriff10-Apr-14 21:41
mveOriginalGriff10-Apr-14 21:41 
GeneralRe: What is Lock in C# Pin
harold aptroot10-Apr-14 22:36
harold aptroot10-Apr-14 22:36 
QuestionWeird Linq error (Ignore this) Pin
Mycroft Holmes10-Apr-14 14:30
professionalMycroft Holmes10-Apr-14 14:30 
AnswerRe: Weird Linq error Pin
Dave Kreskowiak10-Apr-14 14:37
mveDave Kreskowiak10-Apr-14 14:37 
GeneralRe: Weird Linq error Pin
Mycroft Holmes10-Apr-14 19:21
professionalMycroft Holmes10-Apr-14 19:21 
GeneralRe: Weird Linq error Pin
Dave Kreskowiak11-Apr-14 6:56
mveDave Kreskowiak11-Apr-14 6:56 
QuestionGraphic in C# Pin
Member 1068390210-Apr-14 6:03
Member 1068390210-Apr-14 6:03 
AnswerRe: Graphic in C# Pin
Richard MacCutchan10-Apr-14 6:29
mveRichard MacCutchan10-Apr-14 6:29 
GeneralRe: Graphic in C# Pin
Member 1068390211-Apr-14 6:05
Member 1068390211-Apr-14 6:05 
AnswerRe: Graphic in C# Pin
V.10-Apr-14 22:53
professionalV.10-Apr-14 22:53 
AnswerRe: Graphic in C# Pin
Bernhard Hiller10-Apr-14 22:57
Bernhard Hiller10-Apr-14 22:57 
Questionchange interface type to other interface type Pin
Nico Haegens10-Apr-14 4:28
professionalNico Haegens10-Apr-14 4:28 
AnswerRe: change interface type to other interface type Pin
Richard Deeming10-Apr-14 4:41
mveRichard Deeming10-Apr-14 4:41 
GeneralRe: change interface type to other interface type Pin
Nico Haegens10-Apr-14 5:14
professionalNico Haegens10-Apr-14 5:14 
GeneralRe: change interface type to other interface type Pin
Richard Deeming10-Apr-14 6:11
mveRichard Deeming10-Apr-14 6:11 
GeneralRe: change interface type to other interface type Pin
Nico Haegens11-Apr-14 6:07
professionalNico Haegens11-Apr-14 6:07 
Ended up fixing this problem by using delegates instead of interfaces, here is a sample of my code:
private Dictionary<string,Func<ITemplate>> templategetproperties;
private Func<ITemplate> GetITemplateProperty(string name)
{
    if(templategetproperties==null)
    {
        templategetproperties = new Dictionary<string, Func<ITemplate>();
    }
    if(templategetproperties.ContainsKey(name)==false)
    {
        PropertyInfo pinfo = componentruntimetype.GetProperty(name);
        templategetproperties[name] = (Func<ITemplate>)Delegate.CreateDelegate(typeof(Func<ITemplate>), Component, pinfo.GetGetMethod());
    }
    return templategetproperties[name];
}


Used Action instead of Func for the setters.
I think the problem was that the method MakeGenericType of the Type class doesn't transfer the interfaces of the non generic class type to the generic class type. This is only an educated guess though.
AnswerRe: change interface type to other interface type Pin
Keith Barrow10-Apr-14 5:12
professionalKeith Barrow10-Apr-14 5:12 
GeneralRe: change interface type to other interface type Pin
Nico Haegens10-Apr-14 6:26
professionalNico Haegens10-Apr-14 6:26 
GeneralRe: change interface type to other interface type Pin
Keith Barrow10-Apr-14 22:28
professionalKeith Barrow10-Apr-14 22:28 
GeneralRe: change interface type to other interface type Pin
Nico Haegens11-Apr-14 0:31
professionalNico Haegens11-Apr-14 0:31 
GeneralRe: change interface type to other interface type Pin
Keith Barrow11-Apr-14 0:38
professionalKeith Barrow11-Apr-14 0:38 

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.