CodeComment Класс
В этой статье
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Представляет комментарий.
public ref class CodeComment : System::CodeDom::CodeObject
public class CodeComment : System.CodeDom.CodeObject
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeComment : System.CodeDom.CodeObject
type CodeComment = class
inherit CodeObject
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeComment = class
inherit CodeObject
Public Class CodeComment
Inherits CodeObject
- Наследование
- Атрибуты
В этом примере показано использование CodeComment для представления комментария в исходном коде.
// Create a CodeComment with some example comment text.
// The text of the comment.
// Whether the comment is a comment intended for documentation purposes.
CodeComment^ comment = gcnew CodeComment( "This comment was generated from a System.CodeDom.CodeComment",false );
// Create a CodeCommentStatement that contains the comment, in order
// to add the comment to a CodeTypeDeclaration Members collection.
CodeCommentStatement^ commentStatement = gcnew 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.
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
CodeComment можно использовать для представления одного комментария строки.
CodeCommentStatement может содержать CodeComment и позволяет рассматривать его как инструкцию и создавать как код в коллекции инструкций. Примечания с несколькими строками можно представить с несколькими объектами CodeCommentStatement.
Чтобы включить комментарий в граф CodeDOM, который можно создать в исходный код, добавьте CodeComment в CodeCommentStatementи добавьте это в коллекцию инструкций CodeMemberMethod или в коллекцию комментариев CodeNamespace или любого объекта, наследуемого от CodeTypeMember.
Code |
Инициализирует новый экземпляр класса CodeComment. |
Code |
Инициализирует новый экземпляр класса CodeComment с помощью указанного флага комментариев текста и документации. |
Code |
Инициализирует новый экземпляр класса CodeComment с указанным текстом в виде содержимого. |
Doc |
Возвращает или задает значение, указывающее, является ли комментарий комментарием документации. |
Text |
Возвращает или задает текст комментария. |
User |
Возвращает определяемые пользователем данные для текущего объекта. (Унаследовано от CodeObject) |
Equals(Object) |
Определяет, равен ли указанный объект текущему объекту. (Унаследовано от Object) |
Get |
Служит хэш-функцией по умолчанию. (Унаследовано от Object) |
Get |
Возвращает Type текущего экземпляра. (Унаследовано от Object) |
Memberwise |
Создает неглубокую копию текущей Object. (Унаследовано от Object) |
To |
Возвращает строку, представляющую текущий объект. (Унаследовано от Object) |
Продукт | Версии |
---|---|
.NET | 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |