Static Members of Classes in C#

The C# language is object-oriented, which is why the declared member data must be part of a class. Thus, there is no possibility to declare certain variables that can be accessed from anywhere within the application, as it happens, for example, with global variables at the C language level. Making t...

Full description

Saved in:
Bibliographic Details
Published inAnalele Universității "Dunărea de Jos" Galați. Fascicula I, Economie și informatica aplicata Vol. 23; no. 3; pp. 26 - 32
Main Author Adrian LUPASC
Format Journal Article
LanguageEnglish
Published Dunarea de Jos University of Galati 01.12.2017
Online AccessGet full text

Cover

Loading…
More Information
Summary:The C# language is object-oriented, which is why the declared member data must be part of a class. Thus, there is no possibility to declare certain variables that can be accessed from anywhere within the application, as it happens, for example, with global variables at the C language level. Making this work in C# is possible through static members of the class. Declaring a class implies defining some of its member data that later receive values when creating each object. A static member of the class can be interpreted as belonging only to the class, not to the objects subsequently created, which means that for the non-static data, there are as many children as there were objects created, while for the static ones there is only one copy, regardless of the number of created objects. In this regard, this paper presents the main aspects that characterize these abstract concepts of object oriented programming in general and C# language in particular, detailing how to develop an application that includes both static and non-static members. At the same time, particularities in the mirror for the two types of data, restrictions on use and potential limitations are presented.
ISSN:1584-0409
1584-0409