Abstract representation of a fee. This resource type cannot be instantiated instead derived resource types should be used for instantiation.
More...
Abstract representation of a fee. This resource type cannot be instantiated instead derived resource types should be used for instantiation.
Definition at line 13 of file Fee.cs.
virtual void AnalyzeRe.APIType.AfterMembersCloned |
( |
APIType |
originalResource | ) |
|
|
inlineprotectedvirtualinherited |
Invoked following construction if the current instance has been created using a member-wise clone of some other instance. Override if your derived APIType class contains some members that should not be cloned.
Overriding implementations should be sure to invoke base.AfterMembersCloned().
A sane question for a code reviewer to ask might be: "Why not avoid copying those members in the first place?" The answer is that there is no framework-supported method of excluding members from a MemberwiseClone. The only officially supported solution is to not use the object.MemberwiseClone method at all and instead have each class implement it's own Copy method. In our case, most objects have no need to specialize their copy implementation (even though they could - the ShallowCopy<T> method is marked virtual). It's simpler to simply "correct" any special-case members after the fact, and requires less error-prone code than if the code were responsible for ensuring no members were missed in a copy. It's also faster than any reflection-based approach, even though such an approach could benefit from custom attributes meant to exclude certain members from copying.
Reimplemented in AnalyzeRe.APITypes.APIResource_WithDataEndpoint, AnalyzeRe.APIResourceView.BaseAPIResourceView, AnalyzeRe.Distributions.CustomDistribution, AnalyzeRe.LossSets.LossSet_WithData, AnalyzeRe.Optimization.Candidate, AnalyzeRe.Optimization.OptimizationView, and AnalyzeRe.StaticSimulation.
Definition at line 37 of file APIType.cs.
virtual T AnalyzeRe.APIType.ShallowCopy< T > |
( |
| ) |
|
|
inlinevirtualinherited |
Create a shallow copy of this object.
- See also
- ExtensionMethods.DeepCopy<T>
for a serializer-based copy method.
- Returns
- A shallow copy of this object.
If this object contains any members that reference the current object (this), the class should override this method to avoid cloning a reference to the old class.
Implements AnalyzeRe.IAPIType.
Definition at line 14 of file APIType.cs.