473,473 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Write a property on one line

If I want to write this in one line; how do I achieve it?

Public Property x1() As Integer

Get

Return _x1

End Get

Set(ByVal Value As Integer)

_x1 = Value

End Set

End Property

/k
Nov 21 '05 #1
14 1103
"kurt sune" <ap*@apa.cx> schrieb:
If I want to write this in one line; how do I achieve it?


That's not supported.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #2
Kurt,

You can create a C# class and use that than in your project.

One of by some found bad things of VB languages is that the VBCrLf has a
kind of same meaning as in C languages the " ;"

I prefer it by the way over everytime typing the ";"

Just my thought,

Cor
Nov 21 '05 #3
I'm curious because I've never seen the _x1. It appears as if you have
dimensioned x1 as an array of integers. What does the property x1() return?
Would appreciate any help you can give me to understand this. Thanks.

"kurt sune" wrote:
If I want to write this in one line; how do I achieve it?

Public Property x1() As Integer

Get

Return _x1

End Get

Set(ByVal Value As Integer)

_x1 = Value

End Set

End Property

/k

Nov 21 '05 #4
I'm curious because I've never seen the _x1. It appears as if you have
dimensioned x1 as an array of integers. What does the property x1() return?
Would appreciate any help you can give me to understand this. Thanks.

"kurt sune" wrote:
If I want to write this in one line; how do I achieve it?

Public Property x1() As Integer

Get

Return _x1

End Get

Set(ByVal Value As Integer)

_x1 = Value

End Set

End Property

/k

Nov 21 '05 #5
"Dennis" <De****@discussions.microsoft.com> schrieb:
I'm curious because I've never seen the _x1. It appears as if you have
dimensioned x1 as an array of integers. What does the property x1()
return?
Would appreciate any help you can give me to understand this. Thanks.


You can make the property return a whole integer array:

\\\
Private m_X() As Integer
..
..
..
Public Property X() As Integer()
Get
Return m_X
End Get
Set(ByVal Value() As Integer)
m_X = Value
End Set
End Property
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #6
"Dennis" <De****@discussions.microsoft.com> schrieb:
I'm curious because I've never seen the _x1. It appears as if you have
dimensioned x1 as an array of integers. What does the property x1()
return?
Would appreciate any help you can give me to understand this. Thanks.


You can make the property return a whole integer array:

\\\
Private m_X() As Integer
..
..
..
Public Property X() As Integer()
Get
Return m_X
End Get
Set(ByVal Value() As Integer)
m_X = Value
End Set
End Property
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #7
Thanks. Then does the following work and if so, is xcopy a deep copy or
shallow copy?

dim x() as integer
dim xcopy() as integer

xcopy = _x
'or
_xcopy=x

"Herfried K. Wagner [MVP]" wrote:
"Dennis" <De****@discussions.microsoft.com> schrieb:
I'm curious because I've never seen the _x1. It appears as if you have
dimensioned x1 as an array of integers. What does the property x1()
return?
Would appreciate any help you can give me to understand this. Thanks.


You can make the property return a whole integer array:

\\\
Private m_X() As Integer
..
..
..
Public Property X() As Integer()
Get
Return m_X
End Get
Set(ByVal Value() As Integer)
m_X = Value
End Set
End Property
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #8
Thanks. Then does the following work and if so, is xcopy a deep copy or
shallow copy?

dim x() as integer
dim xcopy() as integer

xcopy = _x
'or
_xcopy=x

"Herfried K. Wagner [MVP]" wrote:
"Dennis" <De****@discussions.microsoft.com> schrieb:
I'm curious because I've never seen the _x1. It appears as if you have
dimensioned x1 as an array of integers. What does the property x1()
return?
Would appreciate any help you can give me to understand this. Thanks.


You can make the property return a whole integer array:

\\\
Private m_X() As Integer
..
..
..
Public Property X() As Integer()
Get
Return m_X
End Get
Set(ByVal Value() As Integer)
m_X = Value
End Set
End Property
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #9
"Dennis" <De****@discussions.microsoft.com> schrieb:
Then does the following work and if so, is xcopy a deep copy or
shallow copy?

dim x() as integer
dim xcopy() as integer

xcopy = _x
'or
_xcopy=x


Arrays are reference types, both variables will point to the same array
afterwards.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #10
"Dennis" <De****@discussions.microsoft.com> schrieb:
Then does the following work and if so, is xcopy a deep copy or
shallow copy?

dim x() as integer
dim xcopy() as integer

xcopy = _x
'or
_xcopy=x


Arrays are reference types, both variables will point to the same array
afterwards.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #11
Herfried,
Arrays are reference types, both variables will point to the same array
afterwards.

I think that you have to explain that "afterwards" now they both reference
to nothing.

Cor
Nov 21 '05 #12
Herfried,
Arrays are reference types, both variables will point to the same array
afterwards.

I think that you have to explain that "afterwards" now they both reference
to nothing.

Cor
Nov 21 '05 #13
"Cor Ligthert" <no************@planet.nl> schrieb:
Arrays are reference types, both variables will point to the same array
afterwards.


I think that you have to explain that "afterwards" now they both reference
to nothing.


I assumed the OP uses code similar to this:

\\\
Dim a1() As Integer = {1, 2, 3}
Dim a2() As Integer = a1
a2(1) = 99
MsgBox(CStr(a1(1)))
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #14
"Cor Ligthert" <no************@planet.nl> schrieb:
Arrays are reference types, both variables will point to the same array
afterwards.


I think that you have to explain that "afterwards" now they both reference
to nothing.


I assumed the OP uses code similar to this:

\\\
Dim a1() As Integer = {1, 2, 3}
Dim a2() As Integer = a1
a2(1) = 99
MsgBox(CStr(a1(1)))
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #15

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

Similar topics

5
by: Reza Roby | last post by:
The following code reports a runtime error "v has no properties." function ff() { var v; v.x=5; //error alert(v.x); } But this one alerts "undefined":
14
by: Eli | last post by:
I've got a script that I'm trying to debug which uses document.write() to place HTML within a page. In both IE6 and Firefox when I view source, I see only the script itself and not any HTML as...
3
by: Johnny M | last post by:
using Access 2003 Pardon the subject line, but I don't have a better word for this strange behavior (or behavior I don't understand!!!) I have a class module named DepreciationFactor. One of...
3
by: Bill Cohagan | last post by:
I'm writing a console app in c# and am encountering a strange problem. I'm trying to use redirection of the standard input stream to read input from a (xml) file. The following code snippet is from...
2
by: rr | last post by:
Hi, i have to write a file composed of n packets of a given length. I need to write this file writing every packet when i get it, knowing its number and length. I mean: packet #0 -length 100...
4
by: bnob | last post by:
I must read a txt file and when I found a line beginning with the word "Backup", I must replace this line with "Save" The read and the write must done into the same file! I know how to read...
0
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
3
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
1
by: cday119 | last post by:
I have a Class with about 10 properties. All properties return right except for one. It is real annoying and I can't see why its not working. Maybe someone else can see something. It is the...
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
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,...
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...
1
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...
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,...
1
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...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.