Skip to content

Multiple constraints example doesn't make any sense #40268

Closed
@geoff-m

Description

@geoff-m

Type of issue

Code doesn't work

Description

We are given this class declaration:

class EmployeeList<T> where T : Employee, System.Collections.Generic.IList<T>, IDisposable, new()

This class declaration is, at face value, nonsense. At least I personally have a hard time grasping what could be meant by it, and there is no discussion or example involving it in the document, which contains no motivation or way to use such a class. It is not at all clear how it could even be instantiated.

Page URL

https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/generics/constraints-on-type-parameters#feedback

Content source URL

https://github.com/dotnet/docs/blob/main/docs/csharp/programming-guide/generics/constraints-on-type-parameters.md

Document Version Independent Id

22b2c77c-2721-9384-3863-046e391ea4b1

Article author

@BillWagner

Metadata

  • ID: 5712215d-b167-d9cb-bd51-80df0e300d50
  • Service: dotnet-csharp
  • Sub-service: fundamentals

Associated WorkItem - 289448

Metadata

Metadata

Assignees

Labels

📌 seQUESTeredIdentifies that an issue has been imported into Quest.dotnet-csharp/svcfundamentals/subsvcin-prThis issue will be closed (fixed) by an active pull request.

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions