What is the difference between parameter and argument in C#?

A parameter is the variable listed inside the parentheses in the function definition.
An argument is the actual value that is sent to the function when it is called.

Below are examples of each.

// a and b are parameters

public int add(int a, int b) 
    return a + b;

// 2 and 3 are arguments (parameter values)

var sum = add(2, 3); 

Jack Poorte
Jack Poorte
Last updated on Sep 30, 2023

Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.