
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
Difference between Method and Function in C#
Methods and Functions are the same in C#.
However, Methods are used in C# and are functions that operate through a designated class. A method is a group of statements that together perform a task. Every C# program has at least one class with a method named Main.
The following is a simple example showing how to create methods in C#.
Example
class NumberManipulator { public int FindMax(int num1, int num2) { /* local variable declaration */ int result; if (num1 > num2) { result = num1; }else { result = num2; } return result; } ... }
- Related Articles
- Difference between Method and Function in Python
- What is the difference between a method and a function?
- What is the difference between function overriding and method hiding in C#?
- Difference between Function and Procedure
- Difference between Method Overloading and Method Overriding in Java
- Difference between Method Overriding and Method Hiding in C#
- Difference between constructor and method in Java
- Difference between == and equals() method in Java.
- Difference between == and .Equals method in c#
- Difference between SCALAR and COLUMN function
- Difference between Function and Predicate in Java 8
- Difference Between Function Overloading and Overriding in C++
- Difference between readObject and readResolve method in serialization
- Difference Between GET and POST Method in HTML
- Difference Between sleep() and wait() Method in Java

Advertisements