-
-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
123 additions
and
7 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Globalization; | ||
|
||
namespace CliWrap.Magic; | ||
|
||
public readonly partial struct FormattedToString | ||
{ | ||
public string Value { get; } | ||
|
||
public FormattedToString(string value) => Value = value; | ||
} | ||
|
||
public partial struct FormattedToString | ||
{ | ||
public static implicit operator FormattedToString(string value) => new(value); | ||
|
||
public static implicit operator FormattedToString(bool value) => new(value.ToString()); | ||
|
||
public static implicit operator FormattedToString(IFormattable value) => | ||
new(value.ToString(null, CultureInfo.InvariantCulture)); | ||
|
||
public static implicit operator string(FormattedToString value) => value.Value; | ||
} |
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
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