how to create a List class variable with default size of "1",
Hi I am not too sure about the syntax , since I am still very new to VB..
So this is what I have in a class
Code:
Public Class DocumentDelivery
Implements IDisposable
Public Shared RenderList As New List(Of Byte()())
Public Function Initialize(ByRef env As et.User.SystemCommon.Environment, ByRef errs As et.Exec.Utilities.ErrorCollection) As Boolean
m_env = env
m_errs = errs
'set the default capacity List to 1
RenderList.Capacity =1
Return True
End Function
I didn't write the existing class, I am just making changes to it. I am not sure why there is no constructor. However, Intialize() is called every time a the class is created.
Right now, I set the default capacity of the RenderList, (the class variable) to 1 in Initialize method.
Is there a way to set the capacity outside of the initialize method? what is the syntax? Please let me know.
Re: how to create a List class variable with default size of "1",
Since it's a shared member, you can just access it with the fully qualified name:
Code:
DocumentDelivery.RenderList.Capacity = 100
With that being said, Capacity does not actually limit the amount of items you can have in the List, it simply means that the List can hold that many items until it needs to perform a resize operation on itself. It's more of a performance setting, than a functionality setting.