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

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

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

=== Code examples

==== Noncompliant code example

[source,csharp,diff-id=1,diff-type=noncompliant]
----
DateTime myDate = new DateTime(2008, 6, 19, 7, 0, 0, DateTimeKind.Local); // Noncompliant

var now = DateTime.Now; // Noncompliant
----

==== Compliant solution

[source,csharp,diff-id=1,diff-type=compliant]
----
DateTimeOffset myDate = new DateTimeOffset(2008, 6, 19, 7, 0, 0, TimeSpan.FromHours(-7)); // Compliant

var now = DateTimeOffset.Now; // Compliant
----

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

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