Redpoint.StringEnum 2025.1175.340

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Redpoint.StringEnum --version 2025.1175.340
                    
NuGet\Install-Package Redpoint.StringEnum -Version 2025.1175.340
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Redpoint.StringEnum" Version="2025.1175.340" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Redpoint.StringEnum" Version="2025.1175.340" />
                    
Directory.Packages.props
<PackageReference Include="Redpoint.StringEnum" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Redpoint.StringEnum --version 2025.1175.340
                    
#r "nuget: Redpoint.StringEnum, 2025.1175.340"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Redpoint.StringEnum@2025.1175.340
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Redpoint.StringEnum&version=2025.1175.340
                    
Install as a Cake Addin
#tool nuget:?package=Redpoint.StringEnum&version=2025.1175.340
                    
Install as a Cake Tool

Redpoint.StringEnum

This library provides an API for defining and using string-backed enumeration types. These are useful when used with databases, where storing string values for enumerations improves forward and backward compatibility (unlike storing numeric values).

Defining a string-backed enumeration type

You can create a string-backed enumeration, by defining a class like so:

class Example : StringEnum<Example>
{
    public static readonly StringEnumValue<Example> FirstValue = Create("first-value");

    public static readonly StringEnumValue<Example> SecondValue = Create("second-value");

    public static readonly StringEnumValue<Example> ThirdValue = Create("third-value");

    // ...
}

The string values that represent the enumeration are case-and-byte sensitive (ordinal comparison). You can not create enumeration values from a null string; ArgumentNullException will be thrown if you pass a null value to Create.

Defining additional enumeration values at runtime

There is currently no API for defining additional enumeration values at runtime; the possible enumeration values are lazy-loaded once by looking at the static fields and static properties of the class that inherits from StringEnum<T> (via the T type parameter). Both public and non-public fields/properties are included.

This library is both trim and AOT-compatible, as it uses [DynamicallyAccessedMembers] to ensure the fields and properties of the enumeration type are available at runtime for reflection.

Static usage of values

In most code, you'll simply use the static readonly fields you've defined, such as Example.FirstValue. All instances of the value - even those from parsing - are guaranteed to be reference and value equal.

Parsing known values from strings

To parse a value that is known to be valid from a string, you can use Example.Parse or StringEnumValue<Example>.Parse:

var value = Example.Parse("first-value");
var value2 = StringEnumValue<Example>.Parse("second-value");

If the value is not valid when calling Parse, StringEnumParseException will be thrown. You should use TryParse (see below) if the value is potentially invalid.

If you pass a null value to Parse, ArgumentNullException will be thrown.

Parsing potentially invalid string values

If you're unsure whether a string is a valid enumeration value, you can use Example.TryParse or StringEnumValue<Example>.TryParse:

var isValid = Example.TryParse("...", out var value);
var isValid2 = StringEnumValue<Example>.TryParse("...", out var value2);

If you pass a null value to TryParse, ArgumentNullException will be thrown.

Parsing strings to runtime-based enumeration types

If you don't know the type of the string enumeration you want to parse into at compile time, you can use DynamicStringEnumValue.TryParse to parse any string value into an instance of StringEnumValue<T> by passing the StringEnumValue<T> type as the first parameter, like so:

var type = typeof(StringEnumValue<Example>);
var isValid = DynamicStringEnumValue.TryParse(type, "...", out var value);

You can use DynamicStringEnumValue.IsStringEnumValueType to check if type is a constructed generic type of StringEnumValue<T>. The APIs provided by DynamicStringEnumValue are primarily intended to be used with database serialization and deserialization, where the concrete types of values are not known at the point of deserialization.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Redpoint.StringEnum:

Package Downloads
Redpoint.CloudFramework

A framework for building ASP.NET Core applications on top of Google Cloud Firestore in Datastore mode. Not only does this framework provide a model-based API for interacting with Google Cloud Firestore, it contains useful implementations of things like database migrations, distributed locks, geographic indexes and sharded counters.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2025.1198.1048 0 7/17/2025
2025.1198.682 0 7/17/2025
2025.1198.638 0 7/17/2025
2025.1198.574 2 7/17/2025
2025.1198.187 30 7/17/2025
2025.1191.922 131 7/10/2025
2025.1191.235 121 7/10/2025
2025.1190.175 127 7/9/2025
2025.1189.851 129 7/8/2025
2025.1189.841 130 7/8/2025
2025.1187.587 185 7/6/2025
2025.1183.853 141 7/2/2025
2025.1181.644 133 6/30/2025
2025.1175.340 193 6/24/2025
2025.1174.62 149 6/23/2025
2025.1171.352 125 6/20/2025
2025.1169.413 147 6/18/2025
2025.1166.1191 155 6/15/2025
2025.1166.1178 135 6/15/2025
2025.1166.1177 137 6/15/2025
2025.1159.445 118 6/8/2025
2025.1159.364 110 6/8/2025
2025.1159.324 108 6/8/2025
2025.1155.438 147 6/4/2025
2025.1141.1424 149 5/21/2025
2025.1140.383 143 5/20/2025
2025.1140.377 149 5/20/2025
2025.1139.983 156 5/19/2025
2025.1139.952 152 5/19/2025
2025.1139.941 147 5/19/2025
2025.1139.855 139 5/19/2025
2025.1139.850 141 5/19/2025
2025.1139.837 142 5/19/2025
2025.1139.811 144 5/19/2025
2025.1139.806 147 5/19/2025
2025.1139.796 133 5/19/2025
2025.1139.729 140 5/19/2025
2025.1139.719 154 5/19/2025
2025.1139.706 153 5/19/2025
2025.1139.694 143 5/19/2025
2025.1139.679 146 5/19/2025
2025.1139.662 144 5/19/2025
2025.1139.638 140 5/19/2025
2025.1139.628 143 5/19/2025
2025.1139.626 141 5/19/2025
2025.1139.619 140 5/19/2025
2025.1139.605 144 5/19/2025
2025.1139.600 148 5/19/2025
2025.1139.583 144 5/19/2025
2025.1139.573 141 5/19/2025
2025.1139.564 143 5/19/2025
2025.1139.552 152 5/19/2025
2025.1139.543 149 5/19/2025
2025.1138.909 143 5/18/2025
2025.1136.150 204 5/16/2025
2025.1135.267 223 5/15/2025
2025.1135.143 223 5/15/2025
2025.1133.453 237 5/13/2025
2025.1133.351 230 5/13/2025
2025.1133.349 231 5/13/2025
2025.1133.347 244 5/13/2025
2025.1130.236 81 5/10/2025
2025.1129.831 118 5/9/2025
2025.1129.346 140 5/9/2025
2025.1129.345 135 5/9/2025
2025.1121.1370 162 5/1/2025
2025.1119.450 169 4/29/2025
2025.1119.436 163 4/29/2025
2025.1119.409 160 4/29/2025
2025.1119.388 164 4/29/2025
2025.1119.360 159 4/29/2025
2025.1119.328 175 4/29/2025
2025.1119.299 160 4/29/2025
2025.1119.287 162 4/29/2025
2025.1116.868 93 4/26/2025
2025.1116.841 85 4/26/2025
2025.1116.444 91 4/26/2025
2025.1115.498 132 4/25/2025
2025.1115.491 137 4/25/2025
2025.1100.365 186 4/10/2025
2025.1100.336 180 4/10/2025
2025.1100.331 183 4/10/2025
2025.1098.108 175 4/8/2025
2025.1093.291 188 4/3/2025
2025.1091.38 188 4/1/2025
2025.1091.26 188 4/1/2025
2025.1090.237 174 3/31/2025
2025.1089.1386 173 3/30/2025
2025.1083.515 420 3/24/2025
2025.1083.408 354 3/24/2025
2025.1083.398 353 3/24/2025
2025.1083.125 347 3/24/2025
2025.1080.41 162 3/21/2025
2025.1075.357 234 3/16/2025
2025.1073.332 154 3/14/2025
2025.1072.541 183 3/13/2025
2025.1072.536 163 3/13/2025
2025.1064.602 246 3/5/2025
2025.1064.546 224 3/5/2025
2025.1062.589 173 3/3/2025
2025.1061.513 128 3/2/2025
2025.1060.490 117 3/1/2025
2025.1059.134 129 2/28/2025
2025.1057.1020 125 2/26/2025
2025.1056.584 123 2/25/2025
2025.1050.282 143 2/19/2025
2025.1050.232 139 2/19/2025
2025.1049.55 153 2/18/2025
2025.1045.285 131 2/14/2025
2025.1043.288 117 2/12/2025
2025.1043.246 122 2/12/2025
2025.1043.197 127 2/12/2025
2025.1043.180 113 2/12/2025
2025.1043.108 114 2/12/2025
2025.1043.38 112 2/12/2025
2025.1043.27 113 2/12/2025
2025.1042.725 129 2/11/2025
2025.1042.690 119 2/11/2025
2025.1042.688 124 2/11/2025
2025.1042.418 118 2/11/2025
2025.1042.215 124 2/11/2025
2025.1042.203 121 2/11/2025
2025.1042.184 114 2/11/2025
2025.1042.142 125 2/11/2025
2025.1042.127 123 2/11/2025
2025.1037.1327 117 2/6/2025
2025.1036.280 122 2/5/2025
2025.1036.55 127 2/5/2025
2025.1035.1387 136 2/4/2025
2025.1031.111 132 1/31/2025
2025.1030.916 126 1/30/2025
2025.1030.895 131 1/30/2025
2025.1030.592 126 1/30/2025
2025.1029.664 109 1/29/2025
2025.1029.632 108 1/29/2025
2025.1029.596 112 1/29/2025
2025.1028.386 104 1/28/2025
2025.1025.723 108 1/25/2025
2025.1025.712 111 1/25/2025
2025.1019.913 117 1/19/2025
2025.1018.374 112 1/18/2025
2025.1018.285 147 1/18/2025
2025.1017.646 105 1/17/2025
2025.1017.379 139 1/17/2025
2025.1016.1370 117 1/16/2025
2025.1016.765 107 1/16/2025
2025.1016.712 112 1/16/2025
2025.1016.550 110 1/16/2025
2025.1016.541 112 1/16/2025
2025.1016.532 112 1/16/2025
2025.1016.325 106 1/16/2025
2025.1016.308 112 1/16/2025
2025.1016.296 104 1/16/2025
2025.1016.237 128 1/16/2025
2025.1016.184 105 1/16/2025
2025.1016.70 109 1/16/2025
2025.1016.6 110 1/16/2025
2025.1015.1438 108 1/16/2025
2025.1015.1437 105 1/16/2025
2025.1015.1411 106 1/15/2025
2025.1015.240 76 1/15/2025
2025.1015.223 68 1/15/2025
2025.1015.183 77 1/15/2025
2025.1014.1342 84 1/14/2025
2025.1014.273 92 1/14/2025
2025.1014.256 97 1/14/2025
2025.1012.440 97 1/12/2025
2025.1012.327 110 1/12/2025
2025.1012.279 105 1/12/2025
2025.1002.636 122 1/2/2025
2025.1001.1435 131 1/2/2025
2025.1001.1397 122 1/1/2025
2025.1001.770 124 1/1/2025
2025.1001.570 131 1/1/2025
2025.1001.558 118 1/1/2025
2025.1001.421 122 1/1/2025
2025.1001.390 124 1/1/2025
2025.1001.234 135 1/1/2025
2025.1001.123 128 1/1/2025
2024.1360.354 126 12/25/2024
2024.1360.60 116 12/25/2024
2024.1360.32 117 12/25/2024
2024.1358.450 116 12/23/2024
2024.1358.359 119 12/23/2024
2024.1358.312 111 12/23/2024
2024.1358.244 123 12/23/2024
2024.1358.120 111 12/23/2024
2024.1348.253 132 12/13/2024
2024.1345.1379 108 12/10/2024
2024.1345.506 107 12/10/2024
2024.1345.379 107 12/10/2024
2024.1345.145 107 12/10/2024
2024.1345.72 112 12/10/2024
2024.1345.69 104 12/10/2024
2024.1345.15 113 12/10/2024
2024.1344.1436 109 12/10/2024
2024.1344.600 120 12/9/2024
2024.1344.411 120 12/9/2024
2024.1340.379 119 12/5/2024
2024.1340.15 129 12/5/2024
2024.1338.786 126 12/3/2024
2024.1338.722 130 12/3/2024
2024.1338.697 117 12/3/2024
2024.1338.639 124 12/3/2024
2024.1338.541 124 12/3/2024
2024.1338.318 114 12/3/2024
2024.1338.298 117 12/3/2024
2024.1338.98 122 12/3/2024
2024.1337.756 124 12/2/2024
2024.1337.634 124 12/2/2024
2024.1337.625 109 12/2/2024
2024.1337.621 117 12/2/2024
2024.1337.594 115 12/2/2024
2024.1337.136 107 12/2/2024
2024.1336.793 128 12/1/2024
2024.1336.773 124 12/1/2024
2024.1336.305 115 12/1/2024
2024.1336.12 134 12/1/2024
2024.1335.1421 123 11/30/2024
2024.1335.1384 122 11/30/2024
2024.1334.1308 125 11/29/2024
2024.1334.764 115 11/29/2024
2024.1334.722 125 11/29/2024
2024.1330.185 120 11/25/2024
2024.1328.505 128 11/23/2024
2024.1328.470 116 11/23/2024
2024.1328.452 119 11/23/2024
2024.1323.910 129 11/18/2024
2024.1323.653 114 11/18/2024
2024.1323.185 112 11/18/2024
2024.1323.49 109 11/18/2024
2024.1322.714 110 11/17/2024
2024.1320.653 120 11/15/2024
2024.1320.619 109 11/15/2024
2024.1320.601 106 11/15/2024
2024.1320.159 111 11/15/2024
2024.1320.98 112 11/15/2024
2024.1320.2 121 11/15/2024
2024.1319.1431 121 11/15/2024
2024.1319.1335 118 11/14/2024
2024.1317.631 121 11/12/2024
2024.1316.330 130 11/11/2024
2024.1311.540 119 11/6/2024
2024.1306.225 116 11/1/2024
2024.1306.199 126 11/1/2024
2024.1306.171 123 11/1/2024
2024.1306.117 128 11/1/2024
2024.1305.506 114 10/31/2024
2024.1305.502 111 10/31/2024
2024.1305.465 110 10/31/2024
2024.1305.442 112 10/31/2024
2024.1305.399 112 10/31/2024
2024.1299.1070 121 10/25/2024
2024.1289.621 133 10/15/2024
2024.1289.338 118 10/15/2024
2024.1277.836 122 10/5/2024
2024.1277.711 123 10/3/2024
2024.1277.695 118 10/3/2024
2024.1270.409 136 9/26/2024
2024.1269.621 136 9/25/2024
2024.1269.619 119 9/25/2024
2024.1269.605 129 9/25/2024
2024.1242.282 137 8/29/2024
2024.1242.261 133 8/29/2024
2024.1242.233 142 8/29/2024
2024.1238.829 149 8/25/2024
2024.1238.327 149 8/25/2024
2024.1225.297 139 8/12/2024
2024.1205.140 134 7/23/2024
2024.1204.110 141 7/22/2024
2024.1204.62 129 7/22/2024
2024.1190.491 141 7/8/2024
2024.1177.305 136 6/25/2024
2024.1168.700 150 6/16/2024
2024.1168.649 137 6/16/2024
2024.1168.535 144 6/16/2024
2024.1167.643 137 6/15/2024
2024.1166.989 136 6/14/2024
2024.1166.818 133 6/14/2024
2024.1166.535 141 6/14/2024
2024.1166.422 134 6/14/2024
2024.1166.362 134 6/14/2024
2024.1166.360 139 6/14/2024
2024.1165.1212 136 6/13/2024
2024.1165.1160 132 6/13/2024
2024.1165.1019 135 6/13/2024
2024.1165.978 136 6/13/2024
2024.1165.920 130 6/13/2024
2024.1165.908 147 6/13/2024
2024.1165.873 139 6/13/2024
2024.1165.830 133 6/13/2024
2024.1165.806 135 6/13/2024
2024.1165.794 139 6/13/2024
2024.1165.792 145 6/13/2024
2024.1165.761 139 6/13/2024
2024.1165.743 136 6/13/2024
2024.1165.735 140 6/13/2024
2024.1165.713 139 6/13/2024
2024.1165.640 127 6/13/2024
2024.1165.574 141 6/13/2024
2024.1165.466 130 6/13/2024
2024.1165.417 134 6/13/2024
2024.1165.392 134 6/13/2024
2024.1164.341 125 6/12/2024
2024.1155.941 148 6/3/2024
2024.1140.783 151 5/19/2024
2024.1140.692 134 5/19/2024
2024.1140.673 140 5/19/2024
2024.1129.506 143 5/8/2024
2024.1128.831 154 5/7/2024
2024.1124.465 120 5/3/2024
2024.1123.1162 127 5/2/2024
2024.1123.1117 112 5/2/2024
2024.1123.1050 101 5/2/2024
2024.1122.352 139 5/1/2024
2024.1122.233 141 5/1/2024
2024.1115.1101 142 4/24/2024
2024.1115.1048 126 4/24/2024
2024.1115.932 129 4/24/2024
2024.1115.858 139 4/24/2024
2024.1115.665 141 4/24/2024
2024.1115.648 134 4/24/2024
2024.1115.591 143 4/24/2024
2024.1101.390 140 4/10/2024
2024.1100.741 147 4/9/2024
2024.1099.526 146 4/8/2024
2024.1099.466 143 4/8/2024
2024.1098.573 142 4/7/2024
2024.1095.977 143 4/4/2024
2024.1095.847 138 4/4/2024
2024.1095.604 145 4/4/2024
2024.1095.485 163 4/4/2024
2024.1094.930 138 4/3/2024
2024.1094.910 151 4/3/2024
2024.1094.387 155 4/3/2024
2024.1094.313 139 4/3/2024
2024.1093.520 140 4/2/2024
2024.1092.240 138 4/1/2024
2024.1089.1425 152 3/29/2024
2024.1089.983 145 3/29/2024
2024.1089.942 133 3/29/2024
2024.1089.2 148 3/29/2024
2024.1088.1343 138 3/28/2024
2024.1088.1139 147 3/28/2024
2024.1088.875 115 3/28/2024
2024.1088.700 128 3/28/2024
2024.1088.603 147 3/28/2024
2024.1088.590 149 3/28/2024
2024.1088.575 141 3/28/2024
2024.1088.561 147 3/28/2024
2024.1088.506 150 3/28/2024
2024.1088.18 149 3/28/2024
2024.1087.1181 160 3/27/2024
2024.1087.1173 147 3/27/2024
2024.1087.1143 150 3/27/2024
2024.1087.1108 131 3/27/2024
2024.1087.950 148 3/27/2024
2024.1087.939 137 3/27/2024
2024.1087.252 148 3/27/2024
2024.1070.736 146 3/10/2024
2024.1049.1437 155 2/19/2024
2024.1036.571 153 2/5/2024
2024.1036.508 138 2/5/2024
2024.1032.1204 142 2/1/2024
2024.1032.1133 141 2/1/2024
2024.1032.1122 162 2/1/2024
2024.1032.1071 132 2/1/2024
2024.1032.940 135 2/1/2024
2024.1031.912 134 1/31/2024
2024.1031.893 134 1/31/2024
2024.1031.851 122 1/31/2024
2024.1031.829 132 1/31/2024
2024.1031.386 130 1/31/2024
2024.1031.318 149 1/31/2024
2024.1017.460 159 1/17/2024
2024.1017.420 134 1/17/2024
2024.1017.163 135 1/17/2024
2024.1016.414 670 1/16/2024
2024.1012.167 155 1/12/2024
2024.1011.406 149 1/11/2024
2024.1010.315 163 1/10/2024
2023.1358.326 191 12/24/2023
2023.1351.473 155 12/17/2023
2023.1351.445 154 12/17/2023
2023.1351.432 164 12/17/2023
2023.1350.478 157 12/16/2023
2023.1344.600 172 12/10/2023
2023.1344.529 214 12/10/2023
2023.1339.582 173 12/5/2023
2023.1338.1072 175 12/4/2023
2023.1336.844 174 12/2/2023
2023.1335.378 168 12/1/2023
2023.1335.236 164 12/1/2023
2023.1335.203 159 12/1/2023