Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
deleted 1 character in body
Source Link
ikkentim
  • 1.7k
  • 15
  • 30

Change your IUserDefinedListEditViewModel interface to:

public interface IUserDefinedListEditViewModel<T1,T2> where T1 : IUserDefinedListEntryEditViewModel<T2>, where T2 : IBaseUserDefinedListModel 

After that, and update the implementation in APEditViewModel:

public class APEditViewModel : IUserDefinedListEditViewModel<APEntryEditViewModel, APModel> 

The error indicates that with the generic constraint

where T : IUserDefinedListEntryEditViewModel<IBaseUserDefinedListModel> 

only IUserDefinedListEntryEditViewModel<IBaseUserDefinedListModel> and types which implement this interface will be accepted as T. If you want any IBaseUserDefinedListModel to be accepted in the type parameter of T, you need to make it generic as well.

Change your IUserDefinedListEditViewModel interface to:

public interface IUserDefinedListEditViewModel<T1,T2> where T1 : IUserDefinedListEntryEditViewModel<T2>, where T2 : IBaseUserDefinedListModel 

After that, and update the implementation in APEditViewModel:

public class APEditViewModel : IUserDefinedListEditViewModel<APEntryEditViewModel, APModel> 

The error indicates that with the generic constraint

where T : IUserDefinedListEntryEditViewModel<IBaseUserDefinedListModel> 

only IUserDefinedListEntryEditViewModel<IBaseUserDefinedListModel> and types which implement this interface will be accepted as T. If you want any IBaseUserDefinedListModel to be accepted in the type parameter of T, you need to make it generic as well.

Change your IUserDefinedListEditViewModel interface to:

public interface IUserDefinedListEditViewModel<T1,T2> where T1 : IUserDefinedListEntryEditViewModel<T2> where T2 : IBaseUserDefinedListModel 

After that, and update the implementation in APEditViewModel:

public class APEditViewModel : IUserDefinedListEditViewModel<APEntryEditViewModel, APModel> 

The error indicates that with the generic constraint

where T : IUserDefinedListEntryEditViewModel<IBaseUserDefinedListModel> 

only IUserDefinedListEntryEditViewModel<IBaseUserDefinedListModel> and types which implement this interface will be accepted as T. If you want any IBaseUserDefinedListModel to be accepted in the type parameter of T, you need to make it generic as well.

added 7 characters in body
Source Link
ikkentim
  • 1.7k
  • 15
  • 30

UseChange your IUserDefinedListEditViewModel interface to:

public interface IUserDefinedListEditViewModel<T1,T2> where T1 : IUserDefinedListEntryEditViewModel<T2>, where T2 : IBaseUserDefinedListModel 

When you useAfter that, and update the implementation in APEditViewModel:

wherepublic Tclass APEditViewModel : IUserDefinedListEntryEditViewModel<IBaseUserDefinedListModel>IUserDefinedListEditViewModel<APEntryEditViewModel, APModel> 
 

AfterThe error indicates that, you can use the following to tag with the APEditViewModelgeneric constraint

public classwhere APEditViewModelT : IUserDefinedListEditViewModel<APEntryEditViewModel, APModel>IUserDefinedListEntryEditViewModel<IBaseUserDefinedListModel> 

ONLYonly IUserDefinedListEntryEditViewModel<IBaseUserDefinedListModel> and types which implement this interface will be accepted as T. If you want any IBaseUserDefinedListModel to be accepted in the type parameter of T, you need to make it generic as well.

Use

public interface IUserDefinedListEditViewModel<T1,T2> where T1 : IUserDefinedListEntryEditViewModel<T2>, where T2 : IBaseUserDefinedListModel 

When you use

where T : IUserDefinedListEntryEditViewModel<IBaseUserDefinedListModel> 

After that, you can use the following to tag the APEditViewModel

public class APEditViewModel : IUserDefinedListEditViewModel<APEntryEditViewModel, APModel> 

ONLY IUserDefinedListEntryEditViewModel<IBaseUserDefinedListModel> and types which implement this interface will be accepted as T. If you want any IBaseUserDefinedListModel to be accepted in the type parameter of T, you need to make it generic as well.

Change your IUserDefinedListEditViewModel interface to:

public interface IUserDefinedListEditViewModel<T1,T2> where T1 : IUserDefinedListEntryEditViewModel<T2>, where T2 : IBaseUserDefinedListModel 

After that, and update the implementation in APEditViewModel:

public class APEditViewModel : IUserDefinedListEditViewModel<APEntryEditViewModel, APModel> 
 

The error indicates that with the generic constraint

where T : IUserDefinedListEntryEditViewModel<IBaseUserDefinedListModel> 

only IUserDefinedListEntryEditViewModel<IBaseUserDefinedListModel> and types which implement this interface will be accepted as T. If you want any IBaseUserDefinedListModel to be accepted in the type parameter of T, you need to make it generic as well.

Use

public interface IUserDefinedListEditViewModel<T1,T2> where T1 : IUserDefinedListEntryEditViewModel<T2>, where T2 : IBaseUserDefinedListModel 

When you use

where T : IUserDefinedListEntryEditViewModel<IBaseUserDefinedListModel> 

After that, you can use the following to tag the APEditViewModel

public class APEditViewModel : IUserDefinedListEditViewModel<APEntryEditViewModel, APModel> 

ONLY IUserDefinedListEntryEditViewModel<IBaseUserDefinedListModel> and types which implement this interface will be accepted as T. If you want any IBaseUserDefinedListModel to be accepted in the type parameter of T, you need to make it generic as well.

Use

public interface IUserDefinedListEditViewModel<T1,T2> where T1 : IUserDefinedListEntryEditViewModel<T2>, where T2 : IBaseUserDefinedListModel 

When you use

where T : IUserDefinedListEntryEditViewModel<IBaseUserDefinedListModel> 

ONLY IUserDefinedListEntryEditViewModel<IBaseUserDefinedListModel> and types which implement this interface will be accepted as T. If you want any IBaseUserDefinedListModel to be accepted in the type parameter of T, you need to make it generic as well.

Use

public interface IUserDefinedListEditViewModel<T1,T2> where T1 : IUserDefinedListEntryEditViewModel<T2>, where T2 : IBaseUserDefinedListModel 

When you use

where T : IUserDefinedListEntryEditViewModel<IBaseUserDefinedListModel> 

After that, you can use the following to tag the APEditViewModel

public class APEditViewModel : IUserDefinedListEditViewModel<APEntryEditViewModel, APModel> 

ONLY IUserDefinedListEntryEditViewModel<IBaseUserDefinedListModel> and types which implement this interface will be accepted as T. If you want any IBaseUserDefinedListModel to be accepted in the type parameter of T, you need to make it generic as well.

added 357 characters in body
Source Link
ikkentim
  • 1.7k
  • 15
  • 30
Loading
added 34 characters in body
Source Link
Ehsan Sajjad
  • 62.6k
  • 16
  • 113
  • 171
Loading
Source Link
ikkentim
  • 1.7k
  • 15
  • 30
Loading