protected virtual string GenerateSignature() { var signature = $"{_accessModifier.Generate()}"; if (_isStatic) { signature += " static"; } if (_isAbstract) { signature += "abstract"; } if (_isVirtual) { signature += " virtual"; } if (_isPartial) { signature += " partial"; } if (_override) { signature += " override"; } if (!string.IsNullOrWhiteSpace(_returnType)) { signature += $" {_returnType}"; } signature += $" {_name}"; signature += "("; signature += string.Join(", ", Parameters.Select(t => t.GenerateInline())); signature += ")"; if (!HasBody()) { signature += ";"; } return(signature.TrimStart()); }
private string GenerateInterfaceSignature() { var ret = _accessModifier.Generate(); if (_isPartial) { ret += " partial"; } ret += $" interface {_name}"; if (Inheritances.Any()) { ret += " : " + string.Join(", ", Inheritances.Select(inheritance => inheritance.GenerateInline())); } return(ret); }
protected List <string> GenerateUnderlyingProperty() { var ret = new List <string>(); if (Attributes?.Any() == true) { ret.AddRange(GetAttributesLines()); } // property line., var propertyLine = $"{_accessModifier.Generate()}"; if (_isStatic) { propertyLine += " static"; } propertyLine += $" {_type} {_name}"; propertyLine = propertyLine.TrimStart(); ret.Add(propertyLine); // open. ret.Add("{"); // get ret.Add(" get"); ret.Add(" {"); ret.Add($" return {_underlyingMember};"); ret.Add(" }"); if (_canSet) { var setAccess = _accessModifier != AccessModifiers.Omit && _setAccessModifier != _accessModifier ? $"{_setAccessModifier.Generate()} " : ""; ret.Add($" {setAccess}set"); ret.Add(" {"); ret.Add($" {_underlyingMember} = value;"); ret.Add(" }"); } // end ret.Add("}"); return(ret); }
private string GenerateClassSignature() { var ret = _accessModifier.Generate(); if (_isStatic) { ret += " static"; } if (_isPartial) { ret += " partial"; } ret += $" class {_name}"; if (Inheritances.Any()) { ret += " : " + string.Join(", ", Inheritances.Select(inheritance => inheritance.GenerateInline())); } return(ret); }