Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
I am trying to create a class that uses two levels of inheritance as such:

public class QuickDateTokenParcer<TQuickDateRelative, TUserInputOrderAdjustment>
where TQuickDateRelative : AbstractQuickDateRelative<TUserInputOrderAdjustment>, new() 
where TUserInputOrderAdjustment : AbstractUserInputOrderAdjustment, new()


This would be OK except I really do not like specifying it like:

var dic = new QuickDateTokenParcer<QuickDateRelativePast
      <UserInputOrderAdjustmentMdy>, UserInputOrderAdjustmentMdy>(
	"QuickDateStrings.xml", DateTime.Now);


I can obviously get around this, but would like be able to do the following:

var dic = new QuickDateTokenParcer<QuickDateRelativePast
      <UserInputOrderAdjustmentMdy>>(
	"QuickDateStrings.xml", DateTime.Now);


or the following

var dic = new QuickDateTokenParcer<QuickDateRelativePast,
      UserInputOrderAdjustmentMdy>(
	"QuickDateStrings.xml", DateTime.Now);
Posted

1 solution

There's always:
C#
using QuickDateRelativePastMdy = QuickDateRelativePast<UserInputOrderAdjustmentMdy>;
//...
var dic = new QuickDateTokenParcer<QuickDateRelativePastMdy,
                                   UserInputOrderAdjustmentMdy>
                   ("QuickDateStrings.xml", DateTime.Now);
 
Share this answer
 
Comments
Clifford Nelson 3-Oct-12 20:10pm    
Definately an idea, but not what I was hoping for.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900