Today I updated a part of my code using a combination of tuples and tuple deconstruction.
This was the original code:
This file contains 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 AppSettings : IAppSettings | |
{ | |
public AppSettings(string applicationName, string environmentName) | |
{ | |
this.ApplicationName = applicationName; | |
this.EnvironmentName = environmentName; | |
} | |
public string ApplicationName { get; } | |
public string EnvironmentName { get; } | |
} |
And here it is after applying my changes:
This file contains 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 AppSettings : IAppSettings | |
{ | |
public AppSettings(string applicationName, string environmentName) => | |
(ApplicationName, EnvironmentName) = (applicationName, environmentName); | |
public string ApplicationName { get; } | |
public string EnvironmentName { get; } | |
} |
I like it!