Skip to content
This repository has been archived by the owner on Aug 18, 2024. It is now read-only.

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
milandjurdjevic committed May 3, 2024
1 parent ae5f982 commit 6a6f45d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ stringification methods for enum types. This "tool" efficiently scans your sourc
and generates methods that facilitate the conversion of enum members to their corresponding string
representations and vice versa.

## Features
To read more about the library features and usage, please visit the [documentation](src/Strinum/README.md#features) link.

## Benchmark

| Method | Mean | Error | StdDev | Gen0 | Allocated |
Expand Down
28 changes: 28 additions & 0 deletions src/Strinum/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Strinum

Quick and easy conversion between enum and strings using source generator.

## Features

### Convert Enum To String
Convert an enum to a string representation, using the `StringEnum.ToString` method. The output can be customized
using the `StringEnumAttribute` class.

```csharp
enum MyEnum
{
ValueOne,
[StringEnum("Value 2")] ValueTwo
}


string value = StringEnum.ToString(MyEnum.Value);
```

### Convert String To Enum
Convert a string to an enum representation, using the `StringEnum.ToEnum` method. The method returns a null in case
that the string does not match any enum member.

```csharp
MyEnum? value = StringEnum.ToEnum<MyEnum>("Value");
```
4 changes: 2 additions & 2 deletions src/Strinum/Strinum.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
</ItemGroup>

<ItemGroup>
<None Include="..\..\img\icon.png" Pack="true" PackagePath="\"/>
<None Include="..\..\README.md" Pack="true" PackagePath="\"/>
<None Include="icon.png" Pack="true" PackagePath="\"/>
<None Include="README.md" Pack="true" PackagePath="\"/>
<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false"/>
</ItemGroup>

Expand Down
File renamed without changes

0 comments on commit 6a6f45d

Please sign in to comment.