bchavez / bchavez/Bogus

Why do you want to restrict that a generic type must be a class?

Open
#435 0 comments 4 reactions 0 assignees View on GitHub
question
Dominant language
C#
Stars
9.7k
Forks
538
PR merge metrics
No merged PRs in 30d

Description

### Version Information
| Software | Version(s) |
| ------------------------| ---------- |
| Bogus NuGet Package |34.0.2|
| .NET Core? |.NET 6.0.400|
| .NET Full Framework? ||
| Windows OS? |Windows 10 Pro|
| Linux OS? ||
| Visual Studio? |Visual Studio 2022 Community|

### What locale are you using with Bogus?
en-US
### What's the problem?

```csharp
Faker : IFakerTInternal, ILocaleAware, IRuleSet where T : class
```
Why do you want to restrict that a generic type must be a `class`?
In some cases, I use `struct`...

### What possible solutions have you considered?

I have considered using non generic `Faker`.
Examples:
[Using the Faker facade](https://github.com/bchavez/Bogus#using-the-faker-facade)
[Using DataSets directly](https://github.com/bchavez/Bogus#using-datasets-directly)

### Do you have sample code to show what you're trying to do?

_(Please be complete. Provide all code necessary to run your example in LINQPad.)_
_(The more complete code examples are, the more accurate answers will be.)_
_(https://www.linqpad.net)_

Contributor guide

Open the contributing guide

Research direction

Start with the shown Faker declaration and trace its related interfaces and generic constraints; the payload names no file or test. Done should be a maintainer-confirmed decision on whether value types are supported, with the affected behavior and documentation or tests updated accordingly.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.