Do you think are you really using .NET 3.5 feature?
It’s time to kill the old methodologies and writing plenty
of lines of code. See the one of nice feature of
.NET 3.5
Old Methodology:
function string GetString(int intparam)
{
return “inputparameter”+ intparam;
}
String outputvalue= GetString(24);
New Methodology :
Func<int,string>
GetString = i=>“inputparameter”+ i;
String outputvalue= GetString(24);
Here first parameter ( int ) act as input
parameter type and second parameter ( string ) act as output parameter type
- Func<int,bool,string> ==> here int and bool acts as input parameter type and string act as output parameter type
- Func<string> ==> here string acts as output parameter.There is no input parameter here.
- Func<int,string>=(i)=>string.Format("value{0}",i);
- Func<int,bool,string>=(i,b)=>string.Format("value{0}and {1}",i,b) ;
- Func<string>=()=>"test message"; Here there is no input parameter .It returns only string value
Happy Coding :)