SA1402 does not recognise structs
See original GitHub issueGiven the file Foo.cs:
internal class Foo
{
}
internal struct Baz
{
}
internal class Bar
{
}
Only the class Bar
generates a warning; see screenshot below showing struct Baz
does not have green squiggly.
Also, given Baz.cs:
internal struct Baz
{
}
internal class Bar
{
}
internal class Foo
{
}
class Bar
does not generate a warning for SA1402
Changing struct Baz
to class Baz
suddenly makes SA1402 appear for class Bar
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
SA1402 does not fire for record classes · Issue #3542
In other words, I view record as being a modifier/subcategory of the class and struct categories, not a category on its own (this...
Read more >Sa1402 Weekend Admission for Acute Cholangitis Does ...
Weekend hospital admission is not associated with adverse outcomes, namely longer LOS, decreased or delayed ERCP, organ failure, or mortality. Additional ...
Read more >c# - One class per file rule in .NET?
I follow this rule but some of my colleagues disagree with it and argue that if a class is smaller it can be...
Read more >Attenuating Staphylococcus aureus Virulence by Targeting ...
We identify several small-molecule compounds that alter flotillin oligomerization, thus affecting the degradosome activity and reducing. S.
Read more >S.Amdt.1406 to S.2657 - 116th Congress (2019-2020)
In the case of a hearing initiated on a complaint, the refund effective date shall be-- ``(i) not earlier than the date on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Duplicate of #1756. We’ve actually already approved changing the behavior of SA1402 (which would require corresponding documentation updates), but no one has taken it on yet. 😄
If you change the behavior of the rule or make it configurable I think it should also be renamed to avoid confusion. The current name, SA1402FileMayOnlyContainASingleClass, makes it very obvious that it only applies it classes.
If it is made configurable don’t forget interface, enum and delegate.