473,397 Members | 2,056 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,397 software developers and data experts.

"with blocks" in c#

Hi

I'm a VB6 developer attempting to learn C# ....and I've stumbled at the
first hurdle of how to use with blocks.

I'm used to writing:

Dim o as someObject

with o.mainProperty
.subProperty1 = "a"
.subProperty2 = "b"
end with

and I can't even figure that out in c#.

Griff
Feb 9 '06 #1
2 1468
Hi Griff,

Unfortunately there is nothing like that in C#. You'll have to address each
property individually.

someObject o = new someObject();
o.subproperty1 = "a";
o.subproperty2 = "b";

HTH
--
MCSD.NET, MCAD, MCT
"Griff" wrote:
Hi

I'm a VB6 developer attempting to learn C# ....and I've stumbled at the
first hurdle of how to use with blocks.

I'm used to writing:

Dim o as someObject

with o.mainProperty
.subProperty1 = "a"
.subProperty2 = "b"
end with

and I can't even figure that out in c#.

Griff

Feb 9 '06 #2
Hi Griff,
there is no such statement in C#. See the reasons for this:

http://www.gotdotnet.com/team/csharp.../ask.aspx#with

Mark Dawson
http://www.markdawson.org
"Griff" wrote:
Hi

I'm a VB6 developer attempting to learn C# ....and I've stumbled at the
first hurdle of how to use with blocks.

I'm used to writing:

Dim o as someObject

with o.mainProperty
.subProperty1 = "a"
.subProperty2 = "b"
end with

and I can't even figure that out in c#.

Griff

Feb 9 '06 #3

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

Similar topics

68
by: Marco Bubke | last post by:
Hi I have read some mail on the dev mailing list about PEP 318 and find the new Syntax really ugly. def foo(x, y): pass I call this foo(1, 2), this isn't really intuitive to me! Also I...
0
by: Bill | last post by:
I have only a cursory knowledge of Microsoft's Application Blocks, which seem like they might be pretty cool. I'm wondering if any of these (such as the Exception Handling Application Block) can be...
3
by: Arjen | last post by:
Hello, Are the ASP.NET 2.0 "Building Block's" the same this as the Enterprise Library Application Blocks? Thanks! Arjen
5
by: Alexander Myodov | last post by:
Hello, Having heard that Python 2.5 offers some kind of RIIA concept via PEP343, got it downloaded (Windows version) and tried. But it did not work as expected and as wanted. For the time since...
19
by: (PeteCresswell) | last post by:
I'm going over an application written by somebody else and have encountered what looks to me like nested "With"s. Is this something new with MS Access 2003 or am I losing it? Seems to me that...
8
by: Rasmus Kromann-Larsen | last post by:
The With Conundrum I'm currently writing a master thesis on (preparations for) static analysis of JavaScript, and after investigating the with statement, it only even more evident to me that the...
25
by: samjnaa | last post by:
Please check for sanity and approve for posting at python-dev. In Visual Basic there is the keyword "with" which allows an object- name to be declared as governing the following statements. For...
4
by: smashzone | last post by:
Hi all, Can anyone help me with a script to produce an output file of a "df -m" command with ";" seperators. I assume its very easy but I know nothing about Linux/Unix (I'm a newbie) That is: ...
24
by: carnold | last post by:
Hello, I'm a developer coming from C++ and Java ... I've going thru "Effective C#" (which highly recommend for people coming from other languages wanting to learn C#), and it states that "value...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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...
0
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...

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.