C# VB.NET: How to make a jagged string array a public property
-
13-11-2019 - |
Domanda
all i want to do is this:
Public Property TabsCollection()() as String()()
Get
Return _tabsCollection
End Get
Set(ByVal value()() as String()())
_tabsCollection = value
End Set
End Property
but it errors saying: End of statement expected.
Soluzione
TabsCollection()()
value()()
Public Property TabsCollection() As String()()
Get
Return _tabsCollection
End Get
Set(ByVal value As String()())
_tabsCollection = value
End Set
End Property
Altri suggerimenti
You have redundant pairs of parentheses:
Public Property TabsCollection() as String()()
Get
Return _tabsCollection
End Get
Set(ByVal value as String()())
_tabsCollection = value
End Set
End Property
Apart from that, don’t use arrays in that way. Arrays are (almost?) always wrong in a public interface of a class. Furthermore, the name suggests that what you have here is more aptly described by another data structure. A nested array of strings is a circumvention of proper strict typing.
Use this:
Public Property TabsCollection() as String()()
Get
Return _tabsCollection
End Get
Set(ByVal value as String()())
_tabsCollection = value
End Set
End Property
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow