Searching for: Type Methods in C#
A method is a block of code that can be called from another location in the program or class. It is used to reduce the repetition of multiple lines of code. The return statement concludes the execution of the block of code, returning something of type provided in the method header, or null (void method). Within a class, these are known as 'instance methods'. An instance method is tied to a class instance.
Static methods are methods that are called on the class itself, not on a specific object instance. The static modifier ensures implementation is the same across all class instances. In other languages, these are known as 'class methods'.
Used to return a string representation of a non-string (convert non-string to string).
Used to declare a variable. Variables can be implicitly or explicitly typed. Variables declared this way (without a static modifier) within classes are called instance variables. They belong to an instance of the class (i.e. an object).
Next Page >