Difference between Method and Function? [duplicate]
I am a beginner in c# and have a keen interest to learn c#, but I am confused. When I asked some one what the difference is between Function and method, he said to me that there is no difference, that they both have the same functionality.
Now I am quite confused and want to know from good developers what methods and functions are?
Are they both the same? If not, then how do I initialize each one??
Is this way to initialize a function correct?
public void UpdateLeaveStatus(EmployeeLeave objUpdateLeaveStatus)
Please provide proper help as I am new.
Solution 1:
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...
Solution 2:
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.