2023-05-03 11:06:20 +02:00
== Why is this an issue?
2021-06-08 14:23:48 +02:00
When only a single ``++public++`` parameterless constructor is defined in a class, then that constructor can be removed because the compiler would generate it automatically. Similarly, empty ``++static++`` constructors and empty destructors are also wasted keystrokes.
2023-05-03 11:06:20 +02:00
=== Noncompliant code example
2021-06-08 14:23:48 +02:00
2022-02-04 17:28:24 +01:00
[source,csharp]
2021-06-08 14:23:48 +02:00
----
class Sample
{
public Sample() { } // Noncompliant
static Sample() { } // Noncompliant
~Sample() { } // Noncompliant
...
}
----
2023-05-03 11:06:20 +02:00
=== Compliant solution
2021-06-08 14:23:48 +02:00
2022-02-04 17:28:24 +01:00
[source,csharp]
2021-06-08 14:23:48 +02:00
----
class Sample
{
...
}
----
ifdef::env-github,rspecator-view[]
2021-06-08 15:52:13 +02:00
'''
2021-06-08 14:23:48 +02:00
== Comments And Links
(visible only on this page)
2023-05-25 14:18:12 +02:00
=== is related to: S1186
=== on 22 Mar 2016, 17:05:44 Tamas Vajk wrote:
\[~ann.campbell.2] Could you review this spec? Thanks
=== on 22 Mar 2016, 17:36:16 Ann Campbell wrote:
looks good [~tamas.vajk]
2021-06-08 14:23:48 +02:00
endif::env-github,rspecator-view[]