Click here to Skip to main content
16,020,417 members
Home / Discussions / C#
   

C#

 
GeneralRe: textbox input Pin
OriginalGriff4-Mar-18 21:04
mveOriginalGriff4-Mar-18 21:04 
GeneralRe: textbox input Pin
Pete O'Hanlon4-Mar-18 21:10
mvePete O'Hanlon4-Mar-18 21:10 
QuestionHow to create a recursive lambda function ? Pin
Jesus Carroll2-Mar-18 12:26
professionalJesus Carroll2-Mar-18 12:26 
AnswerRe: How to create a recursive lambda function ? PinPopular
Eddy Vluggen2-Mar-18 12:32
professionalEddy Vluggen2-Mar-18 12:32 
PraiseRe: How to create a recursive lambda function ? Pin
Jesus Carroll2-Mar-18 12:48
professionalJesus Carroll2-Mar-18 12:48 
GeneralRe: How to create a recursive lambda function ? Pin
Eddy Vluggen2-Mar-18 13:05
professionalEddy Vluggen2-Mar-18 13:05 
AnswerRe: How to create a recursive lambda function ? Pin
jschell3-Mar-18 11:00
jschell3-Mar-18 11:00 
AnswerRe: How to create a recursive lambda function ? Pin
Richard Deeming5-Mar-18 8:08
mveRichard Deeming5-Mar-18 8:08 
If you're using a recent version of the C# compiler, you might want to consider local functions:
Local functions (C# Programming Guide) | Microsoft Docs[^]

Using the function from the blog post that Eddy linked to, it works almost without change:
C#
int Fib(int n) => n > 1 ? Fib(n - 1) + Fib(n - 2) : n;
Console.WriteLine(Fib(6)); // displays 8

(Of course, the best solution for calculating Fibonacci numbers is to avoid recursion. Smile | :) )



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


QuestionMove Up And Down rows in datagridview and update it in database Pin
Member 133258462-Mar-18 10:49
Member 133258462-Mar-18 10:49 
AnswerRe: Move Up And Down rows in datagridview and update it in database Pin
Eddy Vluggen2-Mar-18 12:34
professionalEddy Vluggen2-Mar-18 12:34 
GeneralRe: Move Up And Down rows in datagridview and update it in database Pin
Member 133258462-Mar-18 23:53
Member 133258462-Mar-18 23:53 
GeneralRe: Move Up And Down rows in datagridview and update it in database Pin
Eddy Vluggen3-Mar-18 2:34
professionalEddy Vluggen3-Mar-18 2:34 
GeneralRe: Move Up And Down rows in datagridview and update it in database Pin
Member 133258463-Mar-18 18:47
Member 133258463-Mar-18 18:47 
GeneralRe: Move Up And Down rows in datagridview and update it in database Pin
Eddy Vluggen4-Mar-18 1:41
professionalEddy Vluggen4-Mar-18 1:41 
QuestionUse from dataReader to bind data to a data gridview Pin
Member 133258462-Mar-18 10:38
Member 133258462-Mar-18 10:38 
AnswerRe: Use from dataReader to bind data to a data gridview Pin
Eddy Vluggen2-Mar-18 12:35
professionalEddy Vluggen2-Mar-18 12:35 
GeneralRe: Use from dataReader to bind data to a data gridview Pin
Member 133258463-Mar-18 0:06
Member 133258463-Mar-18 0:06 
SuggestionRe: Use from dataReader to bind data to a data gridview Pin
Richard Deeming5-Mar-18 8:02
mveRichard Deeming5-Mar-18 8:02 
GeneralRe: Use from dataReader to bind data to a data gridview Pin
Member 1332584616-Mar-18 1:45
Member 1332584616-Mar-18 1:45 
Questiona simpler binding technique for WinForms ? request for code review Pin
BillWoodruff1-Mar-18 2:22
professionalBillWoodruff1-Mar-18 2:22 
AnswerRe: a simpler binding technique for WinForms ? request for code review Pin
Richard Deeming1-Mar-18 3:49
mveRichard Deeming1-Mar-18 3:49 
GeneralRe: a simpler binding technique for WinForms ? request for code review Pin
BillWoodruff1-Mar-18 7:27
professionalBillWoodruff1-Mar-18 7:27 
AnswerRe: a simpler binding technique for WinForms ? request for code review Pin
Eddy Vluggen1-Mar-18 9:23
professionalEddy Vluggen1-Mar-18 9:23 
GeneralRe: a simpler binding technique for WinForms ? request for code review Pin
BillWoodruff1-Mar-18 23:53
professionalBillWoodruff1-Mar-18 23:53 
GeneralRe: a simpler binding technique for WinForms ? request for code review Pin
Eddy Vluggen2-Mar-18 4:20
professionalEddy Vluggen2-Mar-18 4:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.