A checklist for modern development practices that improve the lives of people in a software development team
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #nullable enable | |
| using Sample; | |
| using System; | |
| var testRecord = new TestRecord("Hi", null); | |
| Console.WriteLine(testRecord.NotNullableProperty); | |
| namespace Sample | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #nullable enable | |
| using System; | |
| namespace Sample | |
| { | |
| public class NullGuardExample | |
| { | |
| public string NotNullableProperty { get; } | |
| public string? NullableProperty { get; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #nullable enable | |
| namespace NullObjectExample | |
| { | |
| class Program | |
| { | |
| static void Main() | |
| { | |
| var someService = new SomeService(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| internal class Observer<T> : IObserver<T> | |
| { | |
| static Action<Exception> onError = ((e) => { }); | |
| static Action onCompleted = (() => { }); | |
| private readonly Action<T> _onNext; | |
| private readonly Action<Exception> _onError; | |
| private readonly Action _onCompleted; | |
| public Observer( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.Extensions.Logging; | |
| using Moq; | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Linq.Expressions; | |
| // More detailed samples here: | |
| // https://github.com/MelbourneDeveloper/RestClient.Net/blob/79cca66e02f83a1043c44f215d374139f40f8c12/src/RestClient.Net.UnitTests/UnitTests.cs#L758 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class StringValidator | |
| { | |
| public string InputString { get; } | |
| public StringValidator(string inputString) | |
| { | |
| if (string.IsNullOrEmpty(inputString)) throw new ArgumentNullException(nameof(inputString)); | |
| InputString = inputString; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public record StringValidator(string InputString); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public record StringValidator | |
| { | |
| public string InputString { get; } | |
| public StringValidator(string inputString) | |
| { | |
| if (string.IsNullOrEmpty(inputString)) throw new ArgumentNullException(nameof(inputString)); | |
| InputString = inputString; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| namespace ConsoleApp25 | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| //This throws an exception from the constructor | |
| //var stringValidator = new StringValidator(null); |