Function and method are same functionality that there is no difference. Both are same, there is no difference its just a different term for the same thing in C#.
The methods call as the method in Java, C# etc. The other side “function”s call as the function in PHP, javaScript
The terms “procedure, function, subroutine, subprogram, and method” all really mean the same thing: a callable sub-program within a larger program. But it’s difficult to come up with a definition that captures all variant usages of these terms, because they are not used consistently across programming languages or paradigms.
C#
1 2 3 4 5 6 | public void hello() { Console.WriteLine("Say Hello"); } |
PHP
1 2 3 4 5 6 | function hello() { echo "Hello World"; } |
javaScript
1 2 3 4 5 6 | function hello() { document.write("Hello World"); } |
Java
1 2 3 4 5 6 | public void hello() { System.out.println("Hello World!"); } |