Skip to content

Commit 37eb8d4

Browse files
author
齐天大胖子
authored
Update DefaultValuesObjectGraphVisitor.cs
add a description attribute about property. if used,when Serialize(),the result will have a yaml comment on that property.
1 parent e06e771 commit 37eb8d4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

YamlDotNet/Serialization/ObjectGraphVisitors/DefaultValuesObjectGraphVisitor.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,15 @@ public override bool EnterMapping(IPropertyDescriptor key, IObjectDescriptor val
6767
break;
6868
}
6969

70+
if (yamlMember != null)
71+
{
72+
if (yamlMember.Description != null)
73+
{
74+
context.Emit(new Core.Events.Comment(yamlMember.Description, false));
75+
}
76+
}
77+
7078
return base.EnterMapping(key, value, context);
7179
}
7280
}
73-
}
81+
}

0 commit comments

Comments
 (0)