-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Labels
💡 idea📈enhancementA useful improvement or extension to existing behaviorA useful improvement or extension to existing behavior
Description
There may be cases where a user wants to use DarkConfig on a type that already has static methods named PostDoc or FromDoc. This would cause issues with DarkConfig's method name reflection-based search, and would require the client code to rename the existing methods to avoid a conflict. This is significantly less likely if we're checking the argument types, since one argument type must be DarkConfig.DocNode, but it's still possible.
Instead, the more canonical approach is likely to mark those special functions with annotations:
class Sample {
int foo = 42;
[DarkConfig.PostDoc]
public static Sample PostDoc(Sample sample) {
sample.foo = 99;
return sample;
}
[DarkConfig.FromDoc]
public static Sample FromDoc(Sample sample, DarkConfig.DocNode doc) {
return new Sample { foo = doc.As<int>(); };
}
}
Metadata
Metadata
Assignees
Labels
💡 idea📈enhancementA useful improvement or extension to existing behaviorA useful improvement or extension to existing behavior