Skip to content

Commit 1a3710f

Browse files
committed
feat: increase version
1 parent eb5796c commit 1a3710f

File tree

3 files changed

+70
-31
lines changed

3 files changed

+70
-31
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## v1.0.17
2+
fix doc
3+
add TryParseFast
14
## v1.0.16
25
fix doc warning
36
add GeneratedCodeAttribute attrbiute

README.md

Lines changed: 61 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@ For example:
4545
```csharp
4646

4747
/// <summary>
48-
/// Provides extension methods for operations related to the UserTypeTest enumeration.
49-
/// </summary>
48+
/// Provides extension methods for operations related to the <see cref="global::UnitTests.UserTypeTest" /> enumeration.
49+
/// </summary>
50+
[GeneratedCodeAttribute("Supernova.Enum.Generators", null)]
5051
public static class UserTypeTestEnumExtensions
5152
{
5253
/// <summary>
53-
/// Provides a dictionary that maps <see cref="UserTypeTest" /> values to their corresponding display names.
54+
/// Provides a dictionary that maps <see cref="global::UnitTests.UserTypeTest" /> values to their corresponding display names.
5455
/// </summary>
5556
public static readonly ImmutableDictionary<UnitTests.UserTypeTest, string> DisplayNamesDictionary = new Dictionary<UnitTests.UserTypeTest, string>
5657
{
@@ -61,7 +62,7 @@ For example:
6162
}.ToImmutableDictionary();
6263

6364
/// <summary>
64-
/// Provides a dictionary that maps <see cref="UserTypeTest" /> values to their corresponding descriptions.
65+
/// Provides a dictionary that maps <see cref="global::UnitTests.UserTypeTest" /> values to their corresponding descriptions.
6566
/// </summary>
6667
public static readonly ImmutableDictionary<UnitTests.UserTypeTest, string> DisplayDescriptionsDictionary = new Dictionary<UnitTests.UserTypeTest, string>
6768
{
@@ -72,11 +73,11 @@ For example:
7273
}.ToImmutableDictionary();
7374

7475
/// <summary>
75-
/// Converts the <see cref="UserTypeTest" /> enumeration value to its string representation.
76+
/// Converts the <see cref="global::UnitTests.UserTypeTest" /> enumeration value to its string representation.
7677
/// </summary>
77-
/// <param name="states">The <see cref="UserTypeTest" /> enumeration value.</param>
78+
/// <param name="states">The <see cref="global::UnitTests.UserTypeTest" /> enumeration value.</param>
7879
/// <param name="defaultValue">The default value to return if the enumeration value is not recognized.</param>
79-
/// <returns>The string representation of the <see cref="UserTypeTest" /> value.</returns>
80+
/// <returns>The string representation of the <see cref="global::UnitTests.UserTypeTest" /> value.</returns>
8081
public static string ToStringFast(this UnitTests.UserTypeTest states, string defaultValue = null)
8182
{
8283
return states switch
@@ -89,10 +90,10 @@ For example:
8990
}
9091

9192
/// <summary>
92-
/// Checks if the specified <see cref="UserTypeTest" /> value is defined.
93+
/// Checks if the specified <see cref="global::UnitTests.UserTypeTest" /> value is defined.
9394
/// </summary>
94-
/// <param name="states">The <see cref="UserTypeTest" /> value to check.</param>
95-
/// <returns>True if the <see cref="UserTypeTest" /> value is defined; otherwise, false.</returns>
95+
/// <param name="states">The <see cref="global::UnitTests.UserTypeTest" /> value to check.</param>
96+
/// <returns>True if the <see cref="global::UnitTests.UserTypeTest" /> value is defined; otherwise, false.</returns>
9697
public static bool IsDefinedFast(UnitTests.UserTypeTest states)
9798
{
9899
return states switch
@@ -105,10 +106,10 @@ For example:
105106
}
106107

107108
/// <summary>
108-
/// Checks if the specified string represents a defined <see cref="UserTypeTest" /> value.
109+
/// Checks if the specified string represents a defined <see cref="global::UnitTests.UserTypeTest" /> value.
109110
/// </summary>
110-
/// <param name="states">The string representing a <see cref="UserTypeTest" /> value.</param>
111-
/// <returns>True if the string represents a defined <see cref="UserTypeTest" /> value; otherwise, false.</returns>
111+
/// <param name="states">The string representing a <see cref="global::UnitTests.UserTypeTest" /> value.</param>
112+
/// <returns>True if the string represents a defined <see cref="global::UnitTests.UserTypeTest" /> value; otherwise, false.</returns>
112113
public static bool IsDefinedFast(string states)
113114
{
114115
return states switch
@@ -121,11 +122,11 @@ For example:
121122
}
122123

123124
/// <summary>
124-
/// Converts the <see cref="UserTypeTest" /> enumeration value to its display string.
125+
/// Converts the <see cref="global::UnitTests.UserTypeTest" /> enumeration value to its display string.
125126
/// </summary>
126-
/// <param name="states">The <see cref="UserTypeTest" /> enumeration value.</param>
127+
/// <param name="states">The <see cref="global::UnitTests.UserTypeTest" /> enumeration value.</param>
127128
/// <param name="defaultValue">The default value to return if the enumeration value is not recognized.</param>
128-
/// <returns>The display string of the <see cref="UserTypeTest" /> value.</returns>
129+
/// <returns>The display string of the <see cref="global::UnitTests.UserTypeTest" /> value.</returns>
129130
public static string ToDisplayFast(this UnitTests.UserTypeTest states, string defaultValue = null)
130131
{
131132
return states switch
@@ -138,11 +139,11 @@ For example:
138139
}
139140

140141
/// <summary>
141-
/// Gets the description of the <see cref="UserTypeTest" /> enumeration value.
142+
/// Gets the description of the <see cref="global::UnitTests.UserTypeTest" /> enumeration value.
142143
/// </summary>
143-
/// <param name="states">The <see cref="UserTypeTest" /> enumeration value.</param>
144+
/// <param name="states">The <see cref="global::UnitTests.UserTypeTest" /> enumeration value.</param>
144145
/// <param name="defaultValue">The default value to return if the enumeration value is not recognized.</param>
145-
/// <returns>The description of the <see cref="UserTypeTest" /> value.</returns>
146+
/// <returns>The description of the <see cref="global::UnitTests.UserTypeTest" /> value.</returns>
146147
public static string ToDescriptionFast(this UnitTests.UserTypeTest states, string defaultValue = null)
147148
{
148149
return states switch
@@ -155,9 +156,9 @@ For example:
155156
}
156157

157158
/// <summary>
158-
/// Retrieves an array of all <see cref="UserTypeTest" /> enumeration values.
159+
/// Retrieves an array of all <see cref="global::UnitTests.UserTypeTest" /> enumeration values.
159160
/// </summary>
160-
/// <returns>An array containing all <see cref="UserTypeTest" /> enumeration values.</returns>
161+
/// <returns>An array containing all <see cref="global::UnitTests.UserTypeTest" /> enumeration values.</returns>
161162
public static UnitTests.UserTypeTest[] GetValuesFast()
162163
{
163164
return new[]
@@ -169,9 +170,9 @@ For example:
169170
}
170171

171172
/// <summary>
172-
/// Retrieves an array of strings containing the names of all <see cref="UserTypeTest" /> enumeration values.
173+
/// Retrieves an array of strings containing the names of all <see cref="global::UnitTests.UserTypeTest" /> enumeration values.
173174
/// </summary>
174-
/// <returns>An array of strings containing the names of all <see cref="UserTypeTest" /> enumeration values.</returns>
175+
/// <returns>An array of strings containing the names of all <see cref="global::UnitTests.UserTypeTest" /> enumeration values.</returns>
175176
public static string[] GetNamesFast()
176177
{
177178
return new[]
@@ -183,14 +184,46 @@ For example:
183184
}
184185

185186
/// <summary>
186-
/// Gets the length of the <see cref="UserTypeTest" /> enumeration.
187+
/// Gets the length of the <see cref="global::UnitTests.UserTypeTest" /> enumeration.
187188
/// </summary>
188-
/// <returns>The length of the <see cref="UserTypeTest" /> enumeration.</returns>
189+
/// <returns>The length of the <see cref="global::UnitTests.UserTypeTest" /> enumeration.</returns>
189190
public static int GetLengthFast()
190191
{
191192
return 3;
192193

193194
}
195+
196+
/// <summary>
197+
/// Try parse a string to <see cref="global::UnitTests.UserTypeTest" /> value.
198+
/// </summary>
199+
/// <param name="states">The string representing a <see cref="global::UnitTests.UserTypeTest" /> value.</param>
200+
/// <param name="result">The enum <see cref="global::UnitTests.UserTypeTest" /> parse result.</param>
201+
/// <returns>True if the string is parsed successfully; otherwise, false.</returns>
202+
public static bool TryParseFast(string states, out UnitTests.UserTypeTest result)
203+
{
204+
switch (states)
205+
{
206+
case "Men":
207+
{
208+
result = UnitTests.UserTypeTest.Men;
209+
return true;
210+
}
211+
case "Women":
212+
{
213+
result = UnitTests.UserTypeTest.Women;
214+
return true;
215+
}
216+
case "None":
217+
{
218+
result = UnitTests.UserTypeTest.None;
219+
return true;
220+
}
221+
default: {
222+
result = default;
223+
return false;
224+
}
225+
}
226+
}
194227
}
195228
```
196229

@@ -211,6 +244,9 @@ var names = UserTypeTestEnumExtensions.GetNamesFast(); //string[]
211244
var values = UserTypeTestEnumExtensions.GetValuesFast(); //UserType[]
212245
213246
var length = UserTypeTestEnumExtensions.GetLengthFast(); //3
247+
248+
var menString = "Men";
249+
var result = UserTypeTestEnumExtensions.TryParseFast(menString, out var enumValue);
214250
```
215251

216252
If you had trouble using UserTypeTestEnumExtensions and the IDE did not recognize it. This is an IDE problem and you need to restart the IDE once.

Supernova.Enum.Generators/Supernova.Enum.Generators.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
77
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
88
<GenerateDependencyFile>false</GenerateDependencyFile>
9-
<Version>1.0.16</Version>
10-
<PackageVersion>1.0.16</PackageVersion>
11-
<AssemblyVersion>1.0.16</AssemblyVersion>
9+
<Version>1.0.17</Version>
10+
<PackageVersion>1.0.17</PackageVersion>
11+
<AssemblyVersion>1.0.17</AssemblyVersion>
1212
<PackageReadmeFile>README.md</PackageReadmeFile>
1313
<PackageIcon>icon.png</PackageIcon>
1414
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
1515
<PackageReleaseNotes>
16-
v1.0.16
17-
fix doc warning
18-
add GeneratedCodeAttribute attrbiute
16+
v1.0.17
17+
fix doc
18+
add TryParseFast
1919
</PackageReleaseNotes>
2020
<LangVersion>latest</LangVersion>
2121
</PropertyGroup>

0 commit comments

Comments
 (0)