Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/Guidelines(8th Edition).xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@
<guideline key="Ch14_6baa967" severity="DO" section="Coding" subsection="Types">DO use System.EventArgs or a type that derives from System.EventArgs for a TEventArgs type.</guideline>
<guideline key="Ch03_f566c99" severity="AVOID" section="Coding" subsection="Types">AVOID using implicitly typed local variables unless the data type of the assigned value is obvious.</guideline>
<guideline key="Ch14_3e1089d" severity="CONSIDER" section="Coding" subsection="Types">CONSIDER using System.EventHandler&lt;T&gt; instead of manually creating new delegate types for event handlers unless the parameter names of a custom type offer significant clarification.</guideline>
<guideline severity="CONSIDER" section="CODING" subsection="Variables">CONSIDER using var any time that the initialization of the variable clearly shows what the variable will contain.</guideline>
Copy link
Contributor Author

@joeriddles joeriddles Mar 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without a key, XMLtoMD.GuidelineXmlToMD.Guidelines.GetHashCode throws an error because it expects its Key property to be non-null. @Keboo what do you think is a better solution: refactor GetHashCode on Guideline.cs or add keys to these new XML lines?

See:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O that is not good. I missed that previously. I would expect the Guidline to use all of its members to determine equality/hashcodes.
An even better solution would be to just make it a record type.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will investigate switching to a record type. I haven't been working with C# lately, so I have some reading up to do on how record types work. Fortunately, I know some people that did a meetup on the topic. 😉

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public record Guideline(string Text, string Severity, string Section, string Subsection, string? Key IList<string>? Comments); should probably do it

<guideline severity="CONSIDER" section="CODING" subsection="Variables">CONSIDER using target-typed new expressions any time that the instance clearly shows its type.</guideline>
<guideline key="Ch04_9fa9f67" severity="AVOID" section="Coding" subsection="Whitespace">"AVOID omitting braces, except for the simplest of single-line if statements."</guideline>
<guideline key="Ch04_19bd2d2" severity="DO" section="Coding" subsection="Whitespace">"DO use parentheses to make code more readable, particularly if the operator precedence is not clear to the casual reader."</guideline>
</Guidelines>
5 changes: 5 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"sdk": {
"version": "3.1.407"
}
}