Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27193

CType usage question

$
0
0
Hi

I have a class which just holds strings which im pulling out of a xml file, some of these string are list(of string), im using the basic property get/set thats provided when you start coding them.

the get part is just returning the whole list, the set part is using the value variable to add an item

Code:

Get
return mylist
End Get

Set(ByVal value)
mylist.add(value)
End Set

if i write some code like this

Code:

dim Var as New MyClass
CType(Var.mylist, List(Of String)).Add("NewString")

it adds an item to the list , so my question is (sound obvious but ill ask), does the Get statement return ByRef?

i just stumbled on this because i forgot how i did the property and just tried this to see what would happen.
Ive changed it to how it should be (Var.mylist = "String") but im just curious why this also worked

Viewing all articles
Browse latest Browse all 27193

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>