public static Method WithSync(this Method @this, SyncModifier value = SyncModifier.Asynchronous) => new Method(@this.Name, documentation: @this.Documentation, returnType: @this.ReturnType, @override: @this.Override, access: @this.Access, scope: @this.Scope, async: value, implementation: @this.Implementation, parameters: @this.Parameters, body: @this.Body, attributes: @this.Attributes);
private string Get(SyncModifier async) { switch (async) { case SyncModifier.Asynchronous: return("async "); default: return(""); } }
public Method(string name, string documentation = null, ScopeModifier scope = ScopeModifier.Instance, OverrideModifier @override = OverrideModifier.None, AccessModifier access = AccessModifier.Public, ImplementationModifier implementation = ImplementationModifier.SingleFile, SyncModifier async = SyncModifier.Synchronous, IType returnType = null, Parameter[] parameters = null, Body body = null, Attribute[] attributes = null) { this.Name = name; this.Documentation = documentation; this.Parameters = parameters ?? new Parameter[0]; this.Attributes = attributes ?? new Attribute[0]; this.Body = body; this.ReturnType = returnType; this.Sync = async; this.Override = @override; this.Scope = scope; this.Access = access; this.Implementation = implementation; }