vst.stringparse
Provides a Parse generic extension method for string that converts string to T and no boxing occurs ``` C# // The following code does not occur boxing var a1 = "123".Parse<int>(); // a1 == 123 var a3 = "123".Parse<int?>(); // a3 == 123 ``` # Usage example ``` C# using System; using System.Globalization; using StringParse; void Exmaple1() { _ = "12".Parse<int>(); // 12 // _ = "ss".Parse<int>(); // throw FormatException // with default value, Actually call the TryParse method internally _ = "12".ParseOr(10); // 12 _ = "ss".ParseOr(10); // 10 // with NumberStyles _ = "F".Parse<int>(NumberStyles.HexNumber); // 15 // parse Nullable _ = "12".Parse<int?>(); // 12 // _ = "ss".Parse<int?>(); // throw FormatException // TryParse _ = "12".TryParse(out int _); // true _ = "ss".TryParse(out int _); // false // Parse Enum _ = "Saturday".ParseEnum<DayOfWeek>(); // DayOfWeek.Saturday _ = "Saturday".TryParseEnum(out DayOfWeek _); // true } ```
nuget.org
2.0.0
about 3 years ago
7
4,438 total
Links
| Registry | nuget.org |
| Source | Repository |
| JSON API | View JSON |
| CodeMeta | codemeta.json |
Package Details
Repository
| Stars | 0 on GitHub |
| Forks | 0 on GitHub |