rspec/rules/S2334/rule.adoc
2022-02-04 16:28:24 +00:00

19 lines
407 B
Plaintext

While both ``++new++`` and ``++Create++`` will yield the same ``++Tuple++``, the ``++Create++`` method automatically infers the argument types, yielding sleeker, more readable code.
== Noncompliant Code Example
[source,text]
----
var fastAnimal = new Tuple<string, int>("Cheetah", 93); // Noncompliant
----
== Compliant Solution
[source,text]
----
var fastAnimal = Tuple.Create("Cheetah", 93);
----