Skip to main content
Top

2018 | OriginalPaper | Chapter

6. Encapsulation with Properties and Indexers

Author : Vaskaran Sarcar

Published in: Interactive C#

Publisher: Apress

Activate our intelligent search to find suitable subject content or patents.

search-config
loading …

Abstract

Teacher starts the discussion: We already know that encapsulation is one of the key characteristics in object-oriented programming. In C#, properties are very important because they help encapsulate an object state. A property is a member that provides a flexible mechanism to read, write, or compute the value of a private field. Initially, properties may appear similar to fields, but actually they have either get or set or both blocks attached with them. These special blocks/methods are called accessors. In simple terms, get blocks are used for reading purposes and set blocks are used for assigning purposes.

Dont have a licence yet? Then find out more about our products and how to get one now:

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Metadata
Title
Encapsulation with Properties and Indexers
Author
Vaskaran Sarcar
Copyright Year
2018
Publisher
Apress
DOI
https://doi.org/10.1007/978-1-4842-3339-9_6

Premium Partner