473,499 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Very simple concept but....

I always get a little confused with this. Quite often I end up writing code
with two lines.
Dim strTest as string
strTest = "test"

How do I write as one line and what is the theory behind instantiating
objects such as ado.net objects like this. Quite often I see very condensed
code, which accomplishes in one line what takes me several.
Nov 19 '05 #1
2 840
Dim strTest As String = "test"

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Chris Kennedy" <ck**************@bleyonder.co.uk> wrote in message
news:OD**************@TK2MSFTNGP12.phx.gbl...
I always get a little confused with this. Quite often I end up writing code
with two lines.
Dim strTest as string
strTest = "test"

How do I write as one line and what is the theory behind instantiating
objects such as ado.net objects like this. Quite often I see very condensed
code, which accomplishes in one line what takes me several.

Nov 19 '05 #2
On Fri, 01 Jul 2005 11:26:03 -0500, Chris Kennedy
<ck**************@bleyonder.co.uk> wrote:
I always get a little confused with this. Quite often I end up writing
code
with two lines.
Dim strTest as string
strTest = "test"

How do I write as one line and what is the theory behind instantiating
objects such as ado.net objects like this. Quite often I see very
condensed
code, which accomplishes in one line what takes me several.


It's really a matter of preference. Accomplishes the same thing; some
believe you should never initialize your variables in the same line (what
you're asking). It makes it easier to delineate defining a variable vs.
where it's initialized, especially when you have alot of variables, or if
the initialization is lengthy (line length gets a little long); often
times people will have a block of code after the list of declarations,
where they they initialize all the variables.

Me, I've done both. No difference either way....

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 19 '05 #3

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

Similar topics

242
13113
by: James Cameron | last post by:
Hi I'm developing a program and the client is worried about future reuse of the code. Say 5, 10, 15 years down the road. This will be a major factor in selecting the development language. Any...
10
1842
by: Jason Curl | last post by:
Greetings, I have an array of 32 values. This makes it extremely fast to access elements in this array based on an index provided by a separate enum. This array is defined of type "unsigned long...
8
5090
by: Ross A. Finlayson | last post by:
I'm trying to write some C code, but I want to use C++'s std::vector. Indeed, if the code is compiled as C++, I want the container to actually be std::vector, in this case of a collection of value...
73
4536
by: Claudio Grondi | last post by:
In the process of learning about some deeper details of Python I am curious if it is possible to write a 'prefix' code assigning to a and b something special, so, that Python gets trapped in an...
50
5649
by: diffuser78 | last post by:
I have just started to learn python. Some said that its slow. Can somebody pin point the issue. Thans
17
1615
by: hanumizzle | last post by:
I have used Perl for a long time, but I am something of an experimental person and mean to try something new. Most of my 'work' with Vector Linux entails the use of Perl (a bit of a misnomer as it...
2
1252
by: Marco | last post by:
I used to write program in Matlab. I have no experience in C++ at all. But my boss order me to convert a matlab function to C++ function, so he can use it with his program. For the concept of the...
0
1123
by: kasim | last post by:
http://www.agloco.com/r/BBFR2592 http://www.clixsense.com/?2159840 http://www.clixsense.com/?2159840 Dear ______, I recently joined AGLOCO because of a friend recommended it to me. I
7
2193
by: Kandiman | last post by:
Hello, Im hoping you can help, for now im trying to learn how to do something so an easy example may help me to gain the concept. I wish to create a hyperlink that when i click it, it prints my...
0
7132
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
7009
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
7178
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
7390
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
5475
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,...
0
4602
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...
0
3103
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3094
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.