Click here to Skip to main content
15,906,333 members
Home / Discussions / C#
   

C#

 
AnswerRe: Ionic.Zip Date Problems. Pin
Dave Kreskowiak8-Mar-19 3:58
mveDave Kreskowiak8-Mar-19 3:58 
GeneralRe: Ionic.Zip Date Problems. Pin
ormonds10-Mar-19 11:31
ormonds10-Mar-19 11:31 
Questionwpf proble with DataGridTextColumn.HeaderTemplate Pin
Member 45620987-Mar-19 6:03
Member 45620987-Mar-19 6:03 
AnswerRe: wpf proble with DataGridTextColumn.HeaderTemplate Pin
OriginalGriff7-Mar-19 6:40
mveOriginalGriff7-Mar-19 6:40 
AnswerRe: wpf proble with DataGridTextColumn.HeaderTemplate Pin
Gerry Schmitz7-Mar-19 7:13
mveGerry Schmitz7-Mar-19 7:13 
QuestionBest way of remembering the history of treeview and other control also across the application in desktop application Pin
Member 101628907-Mar-19 5:23
Member 101628907-Mar-19 5:23 
AnswerRe: Best way of remembering the history of treeview and other control also across the application in desktop application Pin
Richard MacCutchan7-Mar-19 5:32
mveRichard MacCutchan7-Mar-19 5:32 
AnswerRe: Best way of remembering the history of treeview and other control also across the application in desktop application Pin
Eddy Vluggen7-Mar-19 11:35
professionalEddy Vluggen7-Mar-19 11:35 
AnswerRe: Best way of remembering the history of treeview and other control also across the application in desktop application Pin
BillWoodruff8-Mar-19 17:11
professionalBillWoodruff8-Mar-19 17:11 
GeneralRe: Best way of remembering the history of treeview and other control also across the application in desktop application Pin
Member 1016289011-Mar-19 21:43
Member 1016289011-Mar-19 21:43 
GeneralRe: Best way of remembering the history of treeview and other control also across the application in desktop application Pin
BillWoodruff11-Mar-19 21:50
professionalBillWoodruff11-Mar-19 21:50 
GeneralRe: Best way of remembering the history of treeview and other control also across the application in desktop application Pin
Member 1016289013-Mar-19 5:59
Member 1016289013-Mar-19 5:59 
GeneralRe: Best way of remembering the history of treeview and other control also across the application in desktop application Pin
BillWoodruff13-Mar-19 6:44
professionalBillWoodruff13-Mar-19 6:44 
QuestionCan classes be nested Pin
Brian_TheLion6-Mar-19 17:26
Brian_TheLion6-Mar-19 17:26 
AnswerRe: Can classes be nested Pin
BillWoodruff6-Mar-19 19:37
professionalBillWoodruff6-Mar-19 19:37 
GeneralRe: Can classes be nested Pin
Ralf Meier7-Mar-19 0:08
mveRalf Meier7-Mar-19 0:08 
GeneralRe: Can classes be nested Pin
Brian_TheLion7-Mar-19 10:53
Brian_TheLion7-Mar-19 10:53 
GeneralRe: Can classes be nested Pin
Dave Kreskowiak7-Mar-19 11:50
mveDave Kreskowiak7-Mar-19 11:50 
GeneralRe: Can classes be nested Pin
BillWoodruff8-Mar-19 17:03
professionalBillWoodruff8-Mar-19 17:03 
GeneralRe: Can classes be nested Pin
Brian_TheLion9-Mar-19 18:50
Brian_TheLion9-Mar-19 18:50 
AnswerRe: Can classes be nested Pin
Richard Deeming6-Mar-19 21:46
mveRichard Deeming6-Mar-19 21:46 
QuestionCRTP in c#/.NET? Pin
pr1mem0ver6-Mar-19 13:19
pr1mem0ver6-Mar-19 13:19 
I found different solutions to this sort of CRTP problem previously... but can't think of a way around it this time.

The main form used by my current project allows for moving and resizing even when it doesn't have a border. I have seen other people ask about this particular need before (it seems like a fairly common need for custom forms) and I have developed a better solution than what I have seen for answers online. I would like to provide a more generic solution than the one I am using currently for myself and others if possible so hence... my asking this prerequisite question beforehand.

I am needing to create several "controls" in my current project that have this same exact behavior so I want to write an inheritable class for all of them. Simple enough... just write a template that derives from Control. The problem is that none of the derived classes will look and perform like their actual base class in every other way without some way to use a CRTP. It would be nice not to have to write separate base classes for all the seperate possible control types, including forms. Is there a way to write a generic class to cover all controls that one would want to use? Something that effectively does what this would do if this were c++? (I realize that the where statement is c# but there are ways to accomplish the same basic idea in c++).
C#
public class MovableControl<InheritedControl> : InheritedControl where InheritedControl : Control
{
	//...
}

In c# the above class definition doesn't compile because in .NET inheriting from a template parameter is not allowed (which is why I need an alternative solution.). Of course I will continue hunting on my own, or worst case, brute force it (by creating the separate classes) but I thought I would ask here in case someone already had an idea.
AnswerRe: CRTP in c#/.NET? Pin
BillWoodruff6-Mar-19 21:15
professionalBillWoodruff6-Mar-19 21:15 
GeneralRe: CRTP in c#/.NET? Pin
pr1mem0ver7-Mar-19 5:09
pr1mem0ver7-Mar-19 5:09 
GeneralRe: CRTP in c#/.NET? Pin
BillWoodruff7-Mar-19 7:00
professionalBillWoodruff7-Mar-19 7:00 

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.