what is named parameters in c#


Visual Studio 2010 and above give us a facility to specify an argument for a particular parameter by associating the arguments with the parameter's name rather than with the parameter's position in the parameter list.
For example:
    public class Employee
    {
        public Employee()
        { }
        public void emp(string fName, string lName, decimal salary)
        {
        // here your code
           
        }
        public void Main(string[] args)
        {
           emp(fName: "dilip", lName: "Singh",salary: 10000);
            //OR
           emp(salary: 10000, fName: "dilip", lName: "Singh");
        }
    }


Related Posts

What is the Use of isNaN Function in JavaScript? A Comprehensive Explanation for Effective Input Validation

In the world of JavaScript, input validation is a critical aspect of ensuring that user-provided data is processed correctly. One indispensa...