// // CodeMethodElement.cs - represents a CodeElement that defines a method // // Author: // Michael Becker // // Copyright (c) 2011-2020 Mike Becker's Software // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . using System; namespace UniversalEditor.ObjectModels.SourceCode.CodeElements { /// /// Represents a that defines a method. /// public class CodeMethodElement : CodeElementContainerElement, INamedCodeElement, IAccessModifiableCodeElement { /// /// Gets or sets the name of the method. /// /// The name of the method. public string Name { get; set; } = String.Empty; public string GetFullName(string separator = ".") { return CodeElement.GetFullName(this, separator); } public CodeAccessModifiers AccessModifiers { get; set; } = CodeAccessModifiers.None; /// /// Gets or sets the return type of the method, or NULL if the method does not return a value (e.g. Sub in Visual Basic or void in C#). /// /// The return type of the method, or NULL if the method does not return a value. public string DataType { get; set; } = null; /// /// Gets or sets a value indicating whether this /// represents an abstract (must be overridden) method. /// /// true if the method is abstract; otherwise, false. public bool IsAbstract { get; set; } = false; /// /// Gets or sets a value indicating whether this /// represents a virtual (may be overridden) method. /// /// true if the method is virtual; otherwise, false. public bool IsVirtual { get; set; } = false; /// /// Gets or sets a value indicating whether this /// represents a method that overrides a method in a base class. /// /// true if the method is overriding a method in a base class; otherwise, false. public bool IsOverriding { get; set; } = false; /// /// Gets or sets a value indicating whether this /// represents a static (local to the type of the class itself, /// not an instance of the class) method. /// /// true if the method is static; otherwise, false. public bool IsStatic { get; set; } = false; /// /// Gets a collection of instances representing the parameters accepted by the method. /// /// The parameters accepted by the method.. public CodeVariableElement.CodeVariableElementCollection Parameters { get; } = new CodeVariableElement.CodeVariableElementCollection(); /// /// Gets a collection of instances representing the generic type parameters accepted by the method. /// /// The generic type parameters accepted by the method.. public CodeVariableElement.CodeVariableElementCollection GenericParameters { get; } = new CodeVariableElement.CodeVariableElementCollection(); } }