A field declaration in C# and a field entry in a class diagram describe the same storage contract using different word order.
This is a complete class definition. Team is an existing custom class; its public fields are not needed for this excerpt.
If the underlying C# feature is unfamiliar, use the lesson below while reading this example.
public class Player
{
public string name;
public int jerseyNumber;
public bool isAvailable;
public Team team;
}Define a Player with a text name, integer jersey, and Boolean availability
Give Player a field that can refer to a Team
All four fields are public
Describe the reference type, without creating a Team instanceThese words describe the class contract, not a sequence of runtime actions. Identify the types, stored members, operation inputs and results, and relationships before choosing compartments and connectors.
Player and Team. Leave space between them for the field-role label.+name : string, +jerseyNumber : int, and +isAvailable : bool. The plus means public.+team outside the boxes and put 0..1 beside the Team endpoint.Compare this reference with the diagram you built in Violet. Layout may differ; the source meaning, labels, and relevant connections should agree.
Read team from Player toward Team. The field declaration does not create a Team instance or prove the field is non-null at a particular pause.