Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public abstract class NutrientDemand
- {
- public int Value { get; }
- protected NutrientDemand(int value)
- {
- this.Value = value;
- }
- public static T Create<T>(int value)
- where T : NutrientDemand
- {
- return (T)typeof(T).GetConstructor(new[] { typeof(int) }).Invoke(new object[] { value });
- }
- }
- public class KDemand : NutrientDemand
- {
- public KDemand(int value) : base(value)
- {
- }
- }
- public class ApplyLeachingStep<TNutriendDemand>
- where TNutriendDemand : NutrientDemand
- {
- public TNutriendDemand Execute(TNutriendDemand nutrientNeed)
- {
- var result = NutrientDemand.Create<TNutriendDemand>(3);
- return result;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement