Created
August 19, 2020 11:47
-
-
Save mrtank/79628643b1511ddf444103e5a9febbd2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BindableBase {} | |
class ValidationRule<T>// where T : BindableBase | |
{} | |
class RuleCollection<VM> where VM : BindableBase | |
{ | |
public RuleCollection<VM> AddRule<T>(VM _, Expression<Func<VM, object>> expression, params ValidationRule<T>[] rules) | |
{ return this; } | |
} | |
public class ValidationService | |
{ | |
private BindableBase bindableBase; | |
private RuleCollection<BindableBase> ruleCollection; | |
internal RuleCollection<VM> For<VM>(VM bindableBase) where VM : BindableBase | |
{ | |
this.bindableBase = bindableBase; | |
var a = new RuleCollection<VM>(); | |
ruleCollection = (RuleCollection<BindableBase>)a; | |
return a; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment