Skip to content

v1.6.0

Latest
Compare
Choose a tag to compare
@JeevanJames JeevanJames released this 13 Aug 14:11
· 13 commits to master since this release

Change log

  • [#10] Added support for the C# 6 null conditional operator by changing the Ini indexer to return null if the section is not found, instead of throwing the KeyNotFoundException.
// Earlier code
string value = ini.TryGetValue("section", out var section) ? section["property"] : null;
if (value == null)
    // Section does not exist

// With C# 6 null conditional operator
string value = ini["section"]?["property"];
if (value == null)
    // Section does not exist

// Alternate non-C# 6 approach
var section = ini["section"];
string value = section != null ? section["property"] : null;
if (value == null)
    // Section does not exist