Difference between Method and Function?
This question already has an answer here:
Both are same, there is no difference its just a different term for the same thing in C#.
Method:
In object-oriented programming, a method is a subroutine (or procedure or function ) associated with a class.
With respect to Object Oriented programming the term "Method" is used, not functions.
When a function is a part of a class, it's called a method.
C# is an OOP language and doesn't have functions that are declared outside of classes, that's why all functions in C# are actually methods.
Though, beside this formal difference, they are the same...
In C#, they are interchangeable (although method is the proper term) because you cannot write a method without incorporating it into a class. If it were independent of a class, then it would be a function. Methods are functions that operate through a designated class.
链接地址: http://www.djcxy.com/p/17304.html上一篇: 方法和功能之间的区别
下一篇: 方法和功能的区别?