Dawn.ValueString
2.1.0
dotnet add package Dawn.ValueString --version 2.1.0
NuGet\Install-Package Dawn.ValueString -Version 2.1.0
<PackageReference Include="Dawn.ValueString" Version="2.1.0" />
paket add Dawn.ValueString --version 2.1.0
#r "nuget: Dawn.ValueString, 2.1.0"
// Install Dawn.ValueString as a Cake Addin #addin nuget:?package=Dawn.ValueString&version=2.1.0 // Install Dawn.ValueString as a Cake Tool #tool nuget:?package=Dawn.ValueString&version=2.1.0
ValueString is intended to be used for convenience when there is a need to initialize typed instances from culture-neutral (invariant) strings - often read from a simple configuration file or a database table.
// ValueString uses the invariant culture when converting
// objects to string if they implement IFormattable.
// So the following value contains "1.5" (dot-separated) even if (1.5).ToString()
// returns "1,5" (comma-separated) due to the current culture.
var value = ValueString.Of(1.5);
// "As" method uses the invariant culture by default.
// It also has an overload accepting an IFormatProvider.
var number = value.As<double>(); // Calls double.Parse.
// Nullable values are supported.
value = ValueString.Of(default(double?));
number = value.As<double>(); // Throws an InvalidCastException.
var nullable = value.As<double?>(); // null.
// Enums are supported.
value = ValueString.Of("Red"); // Enum field name.
var red = value.As<ConsoleColor>();
value = ValueString.Of("12"); // Enum field value.
var green = value.As<ConsoleColor>();
// You can also cast a "dynamic" ValueString to the target type directly.
dynamic d = value;
number = (double)d;
// "Is" is just like "As", but calls the type's TryParse method instead of Parse.
value = ValueString.Of("1.1.1.1");
if (value.Is(out IPAddress address)) // Calls IPAddress.TryParse.
Console.WriteLine("The IP address is: {0}", address);
// An implicit operator exists converting strings to ValueString instances.
value = "1.5";
See the full readme for the information regarding the other functions, internals, performance and special cases.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.0 is compatible. netstandard1.1 was computed. netstandard1.2 was computed. netstandard1.3 is compatible. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net35 is compatible. net40 is compatible. net403 was computed. net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap was computed. uap10.0 was computed. |
Windows Phone | wp8 was computed. wp81 was computed. wpa81 was computed. |
Windows Store | netcore was computed. netcore45 was computed. netcore451 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 3.5
- No dependencies.
-
.NETFramework 4.0
- System.ValueTuple (>= 4.4.0)
-
.NETFramework 4.5
- System.ValueTuple (>= 4.4.0)
-
.NETStandard 1.0
- NETStandard.Library (>= 1.6.1)
- System.ValueTuple (>= 4.4.0)
- System.Xml.XmlSerializer (>= 4.3.0)
-
.NETStandard 1.3
- NETStandard.Library (>= 1.6.1)
- System.ValueTuple (>= 4.4.0)
-
.NETStandard 2.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Dawn.ValueString:
Package | Downloads |
---|---|
OpenSoftware.OptionParser
OptionParser is a library that deals with option parsing and option handling for command-line (CLI) programs. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
2.1.0 | 6,266 | 3/15/2018 | |
2.0.0 | 2,175 | 12/5/2017 | |
1.5.0 | 934 | 12/4/2017 | |
1.4.1 | 941 | 11/30/2017 | |
1.4.0 | 899 | 11/22/2017 | |
1.3.2 | 1,096 | 11/17/2017 | |
1.3.1 | 1,136 | 11/15/2017 | |
1.3.0 | 1,102 | 11/13/2017 | |
1.2.2 | 1,116 | 11/12/2017 | |
1.2.1 | 1,132 | 11/12/2017 | |
1.2.0 | 1,131 | 11/9/2017 | |
1.1.1 | 1,128 | 10/29/2017 | |
1.1.0 | 905 | 10/27/2017 | |
1.0.2 | 918 | 10/13/2017 | |
1.0.1 | 1,021 | 12/5/2016 | |
1.0.0 | 1,208 | 12/3/2016 | |
0.1.0 | 1,648 | 11/29/2016 |
The assembly no longer has SecurityTransparentAttribute.