From the course: C# Best Practices for Developers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Related objects needed once

Related objects needed once - C# Tutorial

From the course: C# Best Practices for Developers

Start my 1-month free trial

Related objects needed once

- [Instructor] Often times an object might depend on another object. For example, we've been working with the actor class and since actors are usually associated with talent agencies we can possibly have an actor class that has an agency as one of its properties and the way that agency object is instantiated depends on how its used. There's three common scenarios. The object might be needed once, for example, the actor might only need to access the agency name one time, or the object might be needed all the time. Let's say the actor always includes the agency object information. And then there's sometimes. Maybe the agency information associated with the actor is only needed if the actor's employed. Let's go ahead starting off with scenario one to see an example. To get started let's go ahead and create an agency class within the project prestige.bis so I'll go ahead and select Add, Class, Agency. We'll make this public and create a property called name, that is of a type string and…

Contents