共用方式為


Objects (C# Programming Guide) 

Objects are programming constructs that have data, behavior, and identity. Object data is contained in the fields, properties, and events of the object, and object behaviors are defined by the methods and interfaces of the object.

Objects have identity — two objects with the same set of data are not necessarily the same object.

Objects in C# are defined through classes and structs — these form the single blueprint from which all objects of that type operate.

Objects Overview

Objects have the following properties:

  • Everything you use in C# is an object, including Windows Forms and controls.

  • Objects are instantiated; that is, they are created from templates defined by classes and structs.

  • Objects use Properties (C# Programming Guide) to obtain and change the information they contain.

  • Objects often have methods and events that allow them to perform actions.

  • Visual Studio provides tools for manipulating objects: the Properties Window allows you to change the attributes of objects such as Windows Forms. The Object Browser allows you to examine the contents of an object.

  • All C# objects inherit from the Object.

For more information:

See Also

Reference

object (C# Reference)
Inheritance (C# Programming Guide)
class (C# Reference)
struct (C# Reference)

Concepts

C# Programming Guide

Other Resources

Remote Objects