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,vbnet,diff-id=1,diff-type=noncompliant]
|
|
|
|
----
|
|
|
|
Function GetFirst(data As LinkedList(Of Integer)) As Integer
|
|
|
|
Return Enumerable.First(data)
|
|
|
|
End Function
|
|
|
|
----
|
|
|
|
|
|
|
|
[source,vbnet,diff-id=2,diff-type=noncompliant]
|
|
|
|
----
|
|
|
|
Function GetLast(data As LinkedList(Of Integer)) As Integer
|
|
|
|
Return Enumerable.Last(data)
|
|
|
|
End Function
|
|
|
|
----
|
|
|
|
|
|
|
|
==== Compliant solution
|
|
|
|
|
|
|
|
[source,vbnet,diff-id=1,diff-type=compliant]
|
|
|
|
----
|
|
|
|
Function GetFirst(data As LinkedList(Of Integer)) As Integer
|
|
|
|
Return data.First.Value
|
|
|
|
End Function
|
|
|
|
----
|
|
|
|
|
|
|
|
[source,vbnet,diff-id=2,diff-type=compliant]
|
|
|
|
----
|
|
|
|
Function GetLast(data As LinkedList(Of Integer)) As Integer
|
|
|
|
Return data.Last.Value
|
|
|
|
End Function
|
|
|
|
----
|
|
|
|
|
2023-05-11 11:01:13 +02:00
|
|
|
|
|
|
|
include::../resources-dotnet.adoc[]
|