473,569 Members | 2,402 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting an array structure from a Class property

Hi,
I am creating a class. I do not have any problem defining the property
statements except when an array is involved. Would someone be able to show
me the correct syntax for a Property statement to Get an entire array
instead of one element of the array.

thanks,
hugh
Nov 21 '05 #1
3 1407
Can a function returning array suffice ?

Kalpesh
Nov 21 '05 #2
http://www.developerfusion.co.uk/show/1047/2/
"Hugh O" <Hu****@newsgro up.nospam> wrote in message
news:ej******** *****@tk2msftng p13.phx.gbl...
Hi,
I am creating a class. I do not have any problem defining the property
statements except when an array is involved. Would someone be able to
show me the correct syntax for a Property statement to Get an entire array
instead of one element of the array.

thanks,
hugh

Nov 21 '05 #3
Hugh,
In addition to the other comments:

When arrays are involved I normally make the property readonly, something
like:

Public Class Person

Public ReadOnly Property Children() As Person()
Get

End Get
End Property

End Class

Note the type is "Person()" which indicates an Array Of Person. Where as
Variables can be defined either as:

Dim people() As Person

Dim people As Person()

Both of the above lines indicates an Array Of Person.
Sometimes I will define an indexed (parameterized) property instead of an
array property:

Public Class Person

Public ReadOnly Property Children(ByVal index As Integer) As Person
Get

End Get
End Property

End Class
--
Hope this helps
Jay
T.S. Bradley - http://www.tsbradley.net
"Hugh O" <Hu****@newsgro up.nospam> wrote in message
news:ej******** *****@tk2msftng p13.phx.gbl...
| Hi,
| I am creating a class. I do not have any problem defining the property
| statements except when an array is involved. Would someone be able to
show
| me the correct syntax for a Property statement to Get an entire array
| instead of one element of the array.
|
| thanks,
| hugh
|
|
Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2987
by: Julian | last post by:
Hi, I am using PHP 4 with classes but I have come across a slight problem... I can't declare an array as a property of a class, ie, class clTest { var $a; clTest()
2
2826
by: akshay4friend | last post by:
Hi, I am creating a structure / class having data type like { DOUBLE x; DOUBLE y; DOUBLE z; }POINT3D; now my data is stored in a file..so i need to create buffer to read
5
2060
by: Laszlo Zsolt Nagy | last post by:
Hughes, Chad O wrote: > Is there any way to create a class method? I can create a class > variable like this: > Hmm, seeing this post, I have decided to implement a 'classproperty' descriptor. But I could not. This is what I imagined: class A(object):
3
2680
by: Faustino Dina | last post by:
Hi, The following code is from an article published in Informit.com at http://www.informit.com/guides/content.asp?g=dotnet&seqNum=142. The problem is the author says it is not a good idea to return an array as a property because it will return a copy of the array instead a reference to it. How can I force the property to return a reference...
3
11457
by: simonc | last post by:
Can you define a property as type Byte array of a specific length? I am trying to pass a byte array which is 3200 bytes in length from one form (in which the bytes are read from a file) to another form (where the content can be edited). I have defined a property for the editing form using the following Dim m_edicin(3199) As Byte Public...
12
2666
by: Saurabh Kumar | last post by:
I have a byte array, which i need to send to a class, where it will be stored in an arraylist. I use the following property in the class to accept the byte array, but it seems that the array is getting corrupted somehow. Is my declaration wrong somewhere? Public WriteOnly Property BytesAdd() As Byte() Set(ByVal Value() As Byte)...
3
6118
by: Ant | last post by:
Hi, I'm using the tag property of the Treenode object to store an string array containing some values. I can assign it to the Tag but when I try to retrieve values from it I get an error: "Object reference not set to object" This is what i'm doing below: // retrieve the array from the treenode tag property memberInfo = (string)tn.Tag;
5
4737
by: Lyle Avery | last post by:
Hello guys, Look at this in c++ file: class T { public: char c; char ca; };
10
6355
by: Scott Townsend | last post by:
So I need to talk to a devices that expects all of the bits and bytes I sent it to be in specific places (not yet 100% defined). I wanted to create a structure/class with all of the data in it and then convert that to a byte array, pass it to the device, then get a reply and then convert that to a structure. I'm having issues with making...
4
1786
by: Etienne-Louis Nicolet | last post by:
I am working on an error handler class. Within a property set method of a given class property I'd like to pass the PropertyInfo to a function. Imagine something like: Public Class MyClass .... Public Property MyProperty() as String Get Return _myProperty End Get
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7679
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6287
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5223
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
946
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.