0
CodeMemberProperty에 CodeCommentStatement를 추가하는 방법을 아는 사람이 있습니까? CodeDOM으로 C# 코드를 생성 할 때 누구입니까?CodeMemberProperty에 CodeCommentStatement를 추가 할 때 CodeDOM으로 C# 코드를 생성 할 때
내가 시도 :
var docStart = new CodeCommentStatement("<summary>", true);
var docContent = new CodeCommentStatement("The description of property", true);
var docEnd = new CodeCommentStatement("</summary>", true);
var property = new CodeMemberProperty {
Name = name,
HasGet = true,
Attributes = MemberAttributes.Public | MemberAttributes.Static,
Type = new CodeTypeReference(typeof(byte[]))
};
var documentation = new CodeCommentStatementCollection { docStart, docContent, docEnd}
property.Comments = new CodeCommentStatementCollection(documentation);
그러나 댓글 속성은 세터하지 않았습니다
그리고 당신은 객체 생성 표현식에서도 이렇게 할 수 있습니다 :'new CodeMemberProperty {Comments = {docStart, ...}}'. – svick
@svick : 추가해 주셔서 감사합니다. 읽기 전용 속성에서 어떻게 작동하는지 알아낼 시간을 가졌습니다. 오늘 확실히 새로운 것을 배웠습니다. 답변을 업데이트했습니다. – Markus
감사합니다 @ 마커스와 @ 스빅! – meorfi