user2593008
user2593008

Reputation: 3

color and file dialog different operator signs

examples:

  1. picturebox1.backcolor = colordialog1.color

  2. picturebox1.load(openfiledialog1.filename)

question: Why does number one use a = sign and number two use parenthesis to use the dialog result?

Upvotes: 0

Views: 46

Answers (1)

Tim Schmelter
Tim Schmelter

Reputation: 460128

Number one is a property and number two a method.

Difference

  • A property normally just gets/sets a private field in a class and should not have side-effects or be an expensive operation.
  • A method in a class can be a procedure that performs some sort of operation on the data within the class.

Upvotes: 2

Related Questions