CodeCommentStatement Класс
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Представляет инструкцию, состоящую из одного комментария.
public ref class CodeCommentStatement : System::CodeDom::CodeStatement
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeCommentStatement : System.CodeDom.CodeStatement
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeCommentStatement = class
inherit CodeStatement
Public Class CodeCommentStatement
Inherits CodeStatement
- Наследование
- Атрибуты
Примеры
В этом примере показано использование CodeCommentStatement комментария в исходном коде.
// Create a CodeComment with some example comment text.
CodeComment comment = new CodeComment(
// The text of the comment.
"This comment was generated from a System.CodeDom.CodeComment",
// Whether the comment is a comment intended for documentation purposes.
false );
// Create a CodeCommentStatement that contains the comment, in order
// to add the comment to a CodeTypeDeclaration Members collection.
CodeCommentStatement commentStatement = new CodeCommentStatement( comment );
// A C# code generator produces the following source code for the preceeding example code:
// // This comment was generated from a System.CodeDom.CodeComment
' Create a CodeComment with some example comment text.
Dim comment As New CodeComment( _
"This comment was generated from a System.CodeDom.CodeComment", _
False) ' Whether the comment is a documentation comment.
' Create a CodeCommentStatement that contains the comment, in order
' to add the comment to a CodeTypeDeclaration Members collection.
Dim commentStatement As New CodeCommentStatement(comment)
' A Visual Basic code generator produces the following source code for the preceeding example code:
' 'This comment was generated from a System.CodeDom.CodeComment
Комментарии
CodeCommentStatement можно использовать для представления инструкции комментария с одной строкой. CodeCommentStatement — это оператор, поэтому его можно вставить в коллекцию операторов и будет отображаться в собственной строке. CodeCommentStatement также можно добавить в коллекцию комментариев или любой объект, производный CodeNamespace от CodeTypeMember.
Конструкторы
| Имя | Описание |
|---|---|
| CodeCommentStatement() |
Инициализирует новый экземпляр класса CodeCommentStatement. |
| CodeCommentStatement(CodeComment) |
Инициализирует новый экземпляр класса с помощью указанного CodeCommentStatement комментария. |
| CodeCommentStatement(String, Boolean) |
Инициализирует новый экземпляр класса с помощью указанного CodeCommentStatement флага комментариев текста и документации. |
| CodeCommentStatement(String) |
Инициализирует новый экземпляр класса, используя указанный текст в качестве содержимого CodeCommentStatement . |
Свойства
| Имя | Описание |
|---|---|
| Comment |
Возвращает или задает содержимое комментария. |
| EndDirectives |
CodeDirectiveCollection Возвращает объект, содержащий конечные директивы. (Унаследовано от CodeStatement) |
| LinePragma |
Возвращает или задает строку, в которой происходит инструкция кода. (Унаследовано от CodeStatement) |
| StartDirectives |
CodeDirectiveCollection Возвращает объект, содержащий директивы start. (Унаследовано от CodeStatement) |
| UserData |
Возвращает определяемые пользователем данные для текущего объекта. (Унаследовано от CodeObject) |
Методы
| Имя | Описание |
|---|---|
| Equals(Object) |
Определяет, равен ли указанный объект текущему объекту. (Унаследовано от Object) |
| GetHashCode() |
Служит хэш-функцией по умолчанию. (Унаследовано от Object) |
| GetType() |
Возвращает Type текущего экземпляра. (Унаследовано от Object) |
| MemberwiseClone() |
Создает неглубокую копию текущей Object. (Унаследовано от Object) |
| ToString() |
Возвращает строку, представляющую текущий объект. (Унаследовано от Object) |