Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void Main(string[] args)
- {
- var view = new MyView();
- view.Bind/*<MyViewModel, MyView, int>*/(view.ViewModel, vm => vm.Prop1, v => v.Prop2);
- }
- }
- class MyViewModel
- {
- public int Prop1 { get; set; }
- }
- class MyView : IViewFor<MyViewModel>
- {
- public int Prop2 { get; set; }
- public MyViewModel ViewModel
- {
- get { return null; }
- }
- }
- static class C
- {
- public static IDisposable Bind<TViewModel, TView, TProp>(
- this TView view,
- TViewModel vm,
- Expression<Func<TViewModel, TProp>> vmProperty,
- Expression<Func<TView, TProp>> viewProperty)
- where TViewModel : class
- where TView : IViewFor<TViewModel>
- {
- return null;
- }
- }
- interface IViewFor<TViewModel>
- {
- TViewModel ViewModel { get; }
- }
Add Comment
Please, Sign In to add comment