We are punting on, but would like to eventually support, more scenarios for the parameter null checking analyzer/code fix such as:
// before
public C(string s)
=> _s = s ?? throw new ArgumentNullException();
// after
public C(string s!!)
=> _s = s;
// before
public C(string s) : base(s ?? throw new ArgumentNullException()) { }
// after
public C(string s!!) : base(s) { }
// before
public C(string s)
{
ArgumentNullException.ThrowIfNull(s, nameof(s));
}
// after
public C(string s!!)
{
}
// before
public C(string s) : base(s == null ? 0 : s.Length)
{
if (s == null) throw new ArgumentNullException();
}
// after
public C(string s!!) : base(s.Length)
{
}
// before
public C(string s) : base(s?.Length)
{
if (s == null) throw new ArgumentNullException();
}
// after
public C(string s!!) : base(s.Length)
{
}
Migrated from #58182 (comment)
We are punting on, but would like to eventually support, more scenarios for the parameter null checking analyzer/code fix such as:
Migrated from #58182 (comment)