Skip to content

AV1506: Add guidance for generic types #87

@bkoelman

Description

@bkoelman

Applies to: "Name a source file to the type it contains (AV1506)"

Consider the next file:

public class TableLoader
{
    // ...
}

public class TableLoader<TKey, TConverter> : TableLoader
{
    // ...
}

Options:

  1. Allow both types to live in the same file, because their names are the same (they only differ in arity)
  2. Split into TableLoader.cs and TableLoader`2.cs (because arity = 2)
  3. Split into TableLoader.cs and TableLoaderTKeyTConverter.cs
  4. Split into TableLoader.cs and TableLoader.generic.cs (nested)

I think it is worth providing guidance on this situation, to align naming accross the entire team. My preference would be 2. Though I often see option 1 in codebases too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions