rspec/rules/S2368/why-dotnet.adoc
Fred Tingaud 51369b610e
Make sure that includes are always surrounded by empty lines (#2270)
When an include is not surrounded by empty lines, its content is inlined
on the same line as the adjacent content. That can lead to broken tags
and other display issues.
This PR fixes all such includes and introduces a validation step that
forbids introducing the same problem again.
2023-06-22 10:38:01 +02:00

25 lines
1.2 KiB
Plaintext

== Why is this an issue?
Using https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/arrays/multidimensional-arrays[multidimensional] and https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/arrays/jagged-arrays[jagged] arrays as method parameters in C# can be challenging for developers.
When these methods are exposed to external users, it requires advanced language knowledge for effective usage.
Determining the appropriate data to pass to these parameters may not be intuitive.
include::{unintuitiveCode}[]
In this example, it cannot be inferred easily what the matrix should look like. Is it a 2x2 Matrix or even a triangular Matrix?
Using a collection, data structure, or class that provides a more suitable representation of the required data is recommended instead of a multidimensional array or jagged array to enhance code readability.
include::{intuitiveCode}[]
As a result, avoiding exposing such methods to external users is recommended.
=== Exceptions
However, using multidimensional and jagged array method parameters internally, such as in `private` or `internal` methods or within `internal` classes, is compliant since they are not publicly exposed.
include::{exceptionCode}[]