1.3.17 Fields Whose Name is the Same As their Class Name

Last Updated: 9/14/2026
The Same Word Can Appear as a Type Name and a Field Name

As class designs become larger, you may encounter a field whose name looks the same as the class used for its type.

For example, inside a different class:

public Team Team;

The two occurrences of Team do not play the same role.

Position Tells You What Each Name Means

Read the declaration from left to right:

public Team Team;

Conceptually:

public  Team  Team
        ↑     ↑
        type  field name

The first Team identifies the custom type.

The second Team identifies the field stored on the current object.

The Type and the Field Are Different Program Elements

Suppose a Player class contains:

public Team Team;

The declaration means:

The field is not the class itself.

It is a member whose declared type happens to have the same spelling as the member name.

Use the Context to Read the Code

Consider:

Team team1 = new Team();
player1.Team = team1;

There are several uses of the word Team:

  • the first Team is a type;
  • new Team() identifies the class being instantiated;
  • player1.Team identifies a field on player1 .

The surrounding syntax tells you which role the name is playing.

The Dot Operator Identifies the Field on an Object

When you see:

player1.Team

the expression means:

The dot operator makes the object-member relationship visible.

Capitalization Can Affect Readability

C# is case-sensitive.

That means:

Team
team

are different identifiers.

Many codebases use naming conventions that make types and fields visually different, such as:

public Team team;

But when existing source or a required design uses:

public Team Team;

you still need to be able to read it correctly.

Do not rely on capitalization alone. Use the declaration structure and surrounding syntax.

A Member Cannot Always Reuse Every Name

There is an important boundary.

A field inside a different class can have the same spelling as another class type.

For example, this can describe a relationship from Player to Team:

public class Player
{
    public Team Team;
}

But a member cannot use the same name as its own enclosing class in a way that conflicts with the class declaration itself.

When reading unfamiliar code, first identify the enclosing class, then identify each member inside it.

Read the Entire Declaration, Not Just the Repeated Word

Instead of seeing:

Team Team

and assuming the code is duplicated, read the roles:

type  field-name

This same habit helps with method parameters and local variables later: names can look similar while playing different roles depending on where they are declared and how they are used.

The Core Idea

When a class name and a field name look the same, determine meaning from position and context:

public Team Team;
       ↑    ↑
       type field

The class type describes what kind of object may be referenced. The field name identifies where that reference is stored on the current object.