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

=== Code examples

==== Noncompliant code example

[source,csharp,diff-id=1,diff-type=noncompliant]
----
Dim Items As New list(Of Integer) From {1, 2, 3}

Dim FirstItem As Integer = Items.FirstOrDefault() ' Noncompliant, this implies the collection might be empty, when we know it is not
----

==== Compliant solution

[source,csharp,diff-id=1,diff-type=compliant]
----
Dim Items As New list(Of Integer) From {1, 2, 3}

Dim FirstItem As Integer = Items.First() ' Compliant
----

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

include::../rspecator.adoc[]
