2010 | OriginalPaper | Buchkapitel
Methods
Aktivieren Sie unsere intelligente Suche um passende Fachinhalte oder Patente zu finden.
Wählen Sie Textabschnitte aus um mit Künstlicher Intelligenz passenden Patente zu finden. powered by
Markieren Sie Textabschnitte, um KI-gestützt weitere passende Inhalte zu finden. powered by
In this chapter, we have taken a detailed look at defining, implementing, and using methods. Methods are the muscles of a C# program. The code statements contained in a method are executed to perform actions and calculations, and the definitions and modifiers define how those methods can be connected together. Without methods, there is no C# program.
We looked at the different types of parameter that can be used in methods, and we learned that parameters are how we pass data around a program. We explored overloading and overriding methods, which are two of the key concepts in object-oriented programming. Finally, we looked at some special kinds of methods: the Main method, the constructor, and so on. These special methods shape the way that programs are executed and objects are differentiated. Along the way, we saw several convenience features, ranging from optional parameters to compiler-generated iterator blocks. There was a lot of information to learn in this chapter, but a good understanding of methods is an essential foundation for effective C# programming.