在VB.NET中使用暗淡值 [英] Use dim values in VB.NET

查看:89
本文介绍了在VB.NET中使用暗淡值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我声明这两个变量用于使用



我尝试过:



然后我用这样的这个







现在我也想调用parallelLines4如何我在上面的函数中调用了这个函数?

i declare these 2 variables for usin function

What I have tried:

then i use these like this



now i want also call parallelLines4 how i call this one in above function?

推荐答案

新声明的缩进与旧声明相比,而usin这个词意味着它可能在一个方法中而不是比外面。如果是这样,那么该变量仅在方法中可用 - 它在方法结束时超出范围,并且不能以任何其他方法访问。

The indentation of the new declaration compared with the old, and the word "usin" implies it might be within a method rather than outside. If so, then the variable is only available within the method - it goes out of scope at the end of the method and cannot be accessed in any other method.
Dim parallelLines3 As New List(Of PointLatLng)
Public Sub MyMethod()
    Dim parallelLines4 As New List(Of PointLatLng)
    ... parallelLines3 and parallelLines4 available here
End Sub
Public Sub MyOther Method()
    ... parallelLines3 available here
    ... parallelLines4 not available here
End Sub

此外,如果您将其声明为使用块的一部分,则它仅在块内可用 - 一旦结束,就无法再次访问。

In addition, if you are declaring it as part of a Using block, then it is only available within the block - once it ends, it can't be accessed again.

Public Sub MyOther Method()
    Using parallelLines4 As New List(Of PointLatLng)
        ... parallelLines4 available here
    End Using
    ... parallelLines4 not available here
End Sub


这篇关于在VB.NET中使用暗淡值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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