VB.Net 中的递归函数示例 [英] Recursive function examples in VB.Net
问题描述
我看过其他帖子,但它们大多是用 C# 编写的.对于想要学习递归的人来说,在 VB.Net 中查看真实世界的工作示例可能会有所帮助.如果有人尝试破译和转换C#,这是一个额外的困难刚刚开始在 VB.Net 中进行编程.我确实找到了这篇文章,我现在明白了,但是如果有 VB.Net 示例的帖子,我可能能够更快地找到它.这就是我问这个问题的部分原因:
I have seen other posts, but they are mostly in C#. For someone looking to learn recursion, seeing real world working examples in VB.Net could prove helpful. It's an added difficulty to try to decipher and convert C# if someone is just getting their feet wet programming in VB.Net. I did find this post which I understand now, but if there had been a post of VB.Net examples, I may have been able to pick it up faster.This is in part why I am asking this question:
谁能在 VB.Net 中展示一些简单的递归函数示例?
Can anyone could show some simple examples of recursion functions in VB.Net?
推荐答案
这篇来自 wiki 文章的文章很棒
This one from the wiki article is great
Sub walkTree(ByVal directory As IO.DirectoryInfo, ByVal pattern As String)
For Each file In directory.GetFiles(pattern)
Console.WriteLine(file.FullName)
Next
For Each subDir In directory.GetDirectories
walkTree(subDir, pattern)
Next
End Sub
这篇关于VB.Net 中的递归函数示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!