How to create Lambda extensions chains like this in C#?
someVar.GetOwnProperites().With.DefaultValues.From(datasource);
I saw this syntax in DI like Automapper I think. But I'm not sure how to do it..
How to create Lambda extensions chains like this in C#?
someVar.GetOwnProperites().With.DefaultValues.From(datasource);
I saw this syntax in DI like Automapper I think. But I'm not sure how to do it..
Write an extension method which returns the same object
e.g
public static class Extensions{
public static WhateverYouWantToOperateOn With(this WhateverYouWantToOperateOn source){
//your logic
return source;
}
}
For things like With and DefaultValues, there would be a property in the class which returns the instance of the same class.