在vb.net中我们可以使用什么代替For循环条件? [英] What we can use instead of For loop condition in vb.net ?

查看:79
本文介绍了在vb.net中我们可以使用什么代替For循环条件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在vb.net中有一个用于循环的函数,问题是该函数每次都会被调用,该时间循环将被执行.我想要在单个实例函数中获得调用的其他选项……是否有任何选项.
我有以下代码.

I have a function in vb.net where i used for loop.The problem is that function will get call every time, that time loop will executed. i want other option where in a single instance function get call......is there any option.
i have a following code.

For iSlide = 0 To (_slides.Count - 1)
            If _slides.Item(iSlide).IsPptSlide Then
                Dim sl As PptSlide = CType(_slides.Item(iSlide), PptSlide)
                If sl.IsLocked Then
                    InsertLockedSlide(sl, _presentation.Slides.Count + 1)
                Else
                    InsertPptSlide(sl, _presentation.Slides.Count + 1)
                End If
            ElseIf _slides.Item(iSlide).IsObjectSlide Then
                Dim sl As ObjectSlide = CType(_slides.Item(iSlide), ObjectSlide)
                InsertObjectSlide(sl, _presentation.Slides.Count + 1)
            End If
        Next

推荐答案

您不能说我想要一个循环,但我不想想要循环".您需要说明所需的功能,这些功能不需要循环.如果您想重复执行_slides.Count次,则无法使用某些奇迹般的循环替代来使之更快,您只能将某些事情带出循环(根本不重复),而不能删除循环本身.

—SA
You cannot say "I want a loop but I don''t want a loop". You need to explain what functionality you want which does not require a loop. In you want to repeat something _slides.Count times, you cannot make it faster using some miracle alternative of loop, you can only carry something out of loop (not repeating it at all), but not remove the loop itself.

—SA


这篇关于在vb.net中我们可以使用什么代替For循环条件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆