rspec/rules/S3260/csharp/rule.adoc

52 lines
816 B
Plaintext

== Why is this an issue?
``++private++`` classes and records aren't visible outside of their assemblies anyway, so if they're not extended inside the assemblies, they should be made explicitly non-extensible with the addition of the ``++sealed++`` keyword.
=== Noncompliant code example
[source,csharp]
----
private class MyClass // Noncompliant
{
// ...
}
private record MyRecord // Noncompliant
{
// ...
}
----
=== Compliant solution
[source,csharp]
----
private sealed class MyClass
{
// ...
}
private sealed record MyRecord
{
// ...
}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]