From the course: AutoCAD: Building Add-ins with C#

Unlock the full course today

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

Using the static keyword

Using the static keyword - AutoCAD Tutorial

From the course: AutoCAD: Building Add-ins with C#

Start my 1-month free trial

Using the static keyword

- [Speaker] So far, we've worked with objects, these classes and we've seen that we have to create a new instance of every class, or a copy of that class anytime we want to work with any properties, as well as routines in that class. There are times, though, we simply want to accomplish a function, we want to run a routine that's within a class without having to create a new instance of it every single time. So we're gonna see how to use a keyword called static to accomplish that. Let's open up our exercise files for this video. We'll go to our desktop, exercise files chapter seven and the 07-03 solution. Inside our 07-03 solution explorer, you'll see that a few changes have been made. For example, I right-clicked on my project and created a new folder to store all my classes that are specific to custom objects I've created. And I've moved the base object in the layer object class inside of there. Let's go ahead and open up our layer object class. And you'll see that not only do we…

Contents