2023-05-11 11:01:13 +02:00
|
|
|
include::../why-dotnet.adoc[]
|
|
|
|
|
|
|
|
include::../impact-dotnet.adoc[]
|
|
|
|
|
|
|
|
include::../how-dotnet.adoc[]
|
|
|
|
|
2023-05-25 14:18:12 +02:00
|
|
|
=== Code examples
|
|
|
|
|
|
|
|
==== Noncompliant code example
|
|
|
|
|
|
|
|
[source,csharp,diff-id=1,diff-type=noncompliant]
|
|
|
|
----
|
|
|
|
int GetFirst(LinkedList<int> data) =>
|
|
|
|
data.First();
|
|
|
|
----
|
|
|
|
|
|
|
|
[source,csharp,diff-id=2,diff-type=noncompliant]
|
|
|
|
----
|
|
|
|
int GetLast(LinkedList<int> data) =>
|
|
|
|
data.Last();
|
|
|
|
----
|
|
|
|
|
|
|
|
==== Compliant solution
|
|
|
|
|
|
|
|
[source,csharp,diff-id=1,diff-type=compliant]
|
|
|
|
----
|
|
|
|
int GetFirst(LinkedList<int> data) =>
|
|
|
|
data.First.Value;
|
|
|
|
----
|
|
|
|
|
|
|
|
[source,csharp,diff-id=2,diff-type=compliant]
|
|
|
|
----
|
|
|
|
int GetLast(LinkedList<int> data) =>
|
|
|
|
data.Last.Value;
|
|
|
|
----
|
|
|
|
|
2023-05-11 11:01:13 +02:00
|
|
|
|
|
|
|
include::../resources-dotnet.adoc[]
|