include::../why-dotnet.adoc[]

include::../impact-dotnet.adoc[]

include::../how-dotnet.adoc[]

=== 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
----


include::../resources-dotnet.adoc[]
