473,398 Members | 2,212 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Shorthand for Property declaration in VB

I have a very simple class that just stores a number of strings so I can use
them in an ArrayList bound to a Repeater. There is no validation or
calculations needed for the properties. Is there any shorthand for this
without having to define a Property and a Get for every single instance
variable? This gets very old when you have many properties (30+). If I
just declare the instance vars as public (renaming them without the my) and
provide no Property accessor, the Repeater can't access them as it
enumerates. It just seems like an excessive amount of code for something so
simple.

Public Class SimpleClass
Private myName, myLabel As String

Public Sub New(ByVal Name As String, ByVal Label As String)
Me.myName = Name
Me.myLabel = Label
End Sub

Public ReadOnly Property Name() As String
Get
Return Me.myName
End Get
End Property

Public ReadOnly Property Label() As String
Get
Return Me.myLabel
End Get
End Property
End Class
Jan 17 '07 #1
0 1094

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

Similar topics

34
by: SeeBelow | last post by:
I see the value of a class when two or more instances will be created, but Python programmers regularly use a class when there will only be one instance. What is the benefit of this? It has a...
7
by: Fabian Neumann | last post by:
Hi! I got a problem with font-family inheritance. Let's say I have CSS definitions like: p { font:normal 10pt Verdana; } strong { font:normal 14pt inherit;
7
by: Dave | last post by:
Occasionally, I've seen people write CSS code in shorthand for specifying font styles. I don't exactly remember how it goes, but sometimes I see things like this: SPAN {font: arial, helvetica...
9
by: Andy | last post by:
I'm a beginning student of CSS and the shorthand order for margins, etc. raised an eyebrow. The clockwise order is what bothers me: p.margin {margin: cm cm cm cm} I think the order should...
354
by: Montrose... | last post by:
After working in c# for a year, the only conclusion I can come to is that I wish I knew c. All I need is Linux, the gnu c compiler and I can do anything. Web services are just open sockets...
5
by: David N | last post by:
All, I created a control that have the following property defined: private bool autoSearch My control is compiled and created fine. But, after adding the control to my form, I noticed...
0
by: Ioannis Vranos | last post by:
According to the C++/CLI draft the property defined below should work: ref class Vertex { private: cli::array<int> ^points; public:
2
by: Ben Voigt | last post by:
The C# Language Specification says: A virtual property declaration specifies that the accessors of the property are virtual. The virtual modifier applies to both accessors of a read-write...
2
by: fred | last post by:
Hi, Why should I do a cast (IOfferSetter) in the constructor of the Test class? Thanks. Fred public interface IOfferSetter { object Offer { set;} } public class OfferCtx {
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...
0
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,...

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.