Hi guys
This article we will explain what is the new
c# features named and optional parameters
Named and
optional parameters available in c # 4.0 version. Now we discuss what is named.
Named:-
Named parameter
a developer can skip parameters that have default values and named only the
parameters that have non-default values.
Optional parameters:-
It gives
scope us to declare a default value to method parameter. So we don’t need to
define it every time when we call the method.
Example:-
Public class
A
{
Public static
void callme(string name= “Sanjib”,
string city =”New Delhi”, int id)
{}
Static void
main(string[] args)
{
Method(100);
// result of return method is(“Sanjib” ,”New Delhi”,100)
No comments:
Post a Comment