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

keyword with in C#

hi, everyone,
i would like know why c# doesn't have the keyword "with", such as vb does?

Thank u so much;;
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.532 / Virus Database: 326 - Release Date: 27/10/2003
Nov 15 '05 #1
6 7320
Elder,

It was determined that with doesn't add anything to the language in
terms of readability (this is an opinion of the language designers). Also,
"with" was used as a performance enhancement in VB, but in .NET, the
mechanics are different, and the performance benefit is no longer there.
Finally, given C#'s C/C++ heritage, those languages do not have a "with"
statement, so this influenced the decision as well.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Elder Santos" <pe*******@msn.com> wrote in message
news:uQ****************@TK2MSFTNGP11.phx.gbl...
hi, everyone,
i would like know why c# doesn't have the keyword "with", such as vb does?

Thank u so much;;
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.532 / Virus Database: 326 - Release Date: 27/10/2003

Nov 15 '05 #2
Elder Santos <pe*******@msn.com> wrote:
i would like know why c# doesn't have the keyword "with", such as vb does?


See http://www.gotdotnet.com/team/csharp.../ask.aspx#with
and look back a few days in this very forum for discussion on it in a
thread titled "With - End with block in C#".

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #3
Is it me, or was this topic beaten to death already this week? (Oct-28 and
Oct-29 to be specific, so it wouldn't have been too hard to see if the
question had already been addressed)

<sarcasm>

People, could we limit the "why isn't C# more like VB.NET" questions to just
one pert week? PLEASE!!!!! <bg>

For future reference please see the following Q & A:

Q: Why doesn't C# have (or do) <* Insert favorite VB feature here *> like
VB?
A: Because, C# is not VB!

</sarcasm>
Brian W
"Elder Santos" <pe*******@msn.com> wrote in message
news:uQ****************@TK2MSFTNGP11.phx.gbl...
hi, everyone,
i would like know why c# doesn't have the keyword "with", such as vb does?

Thank u so much;;
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.532 / Virus Database: 326 - Release Date: 27/10/2003

Nov 15 '05 #4
Ill never code VB and Ill never do webwhore stuff.

Id rather do COBOL.

VB = da piss

"Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
news:eY**************@TK2MSFTNGP12.phx.gbl...
Is it me, or was this topic beaten to death already this week? (Oct-28 and
Oct-29 to be specific, so it wouldn't have been too hard to see if the
question had already been addressed)

<sarcasm>

People, could we limit the "why isn't C# more like VB.NET" questions to just one pert week? PLEASE!!!!! <bg>

For future reference please see the following Q & A:

Q: Why doesn't C# have (or do) <* Insert favorite VB feature here *> like
VB?
A: Because, C# is not VB!

</sarcasm>
Brian W
"Elder Santos" <pe*******@msn.com> wrote in message
news:uQ****************@TK2MSFTNGP11.phx.gbl...
hi, everyone,
i would like know why c# doesn't have the keyword "with", such as vb does?
Thank u so much;;
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.532 / Virus Database: 326 - Release Date: 27/10/2003


Nov 15 '05 #5
I've many times examined the IL and the final x86 instructions of code made
with "with" in VB.NET and it would appear that there are some optimizations,
at least in the sense, that it assigns a pointer to a register and then the
following uses of the with do some pointer magic with that register, as
opposed to if I don't use the with, every use of the object causes it to
fetch the pointer and then do some pointer magic. It appears there is an
optimization.

"With" is not a pure vb thing, as almost everyone thinks. It's also in
JScript. Though the syntax of it in JScript is horrible, it doesn't use the
preceding . (dot). It's never obvious when looking at the code. In VB,
I've never had a problem with a "with". It does indeed add readibility to
the code, an opinion no C# programmers share (probly because they aren't
used to the grammer and they are so think on thinking "its a VB thing and I
avoid all VB things.".

My opinion is if you don't like/want "with" in C#, then plea with the
language designers to get rid of the "using" statement as well.

But the language must evolve, as does all other languages must evolve.
Keeping features out of one just because they exist in another (one you
don't like) is not a good enough reason to keep it out.

I've read the papers from the C# developers explaining why they left it out
and quite frankly, I've come to the conclusion that they won't do it because
they are too lazy to add it in and because too many C# programmers feel it's
a "VB thing" and despise it not based on any lack of merit. Everytime I've
seen the argument, they are quick to point out something to the effect of
"keep it in VB". They should say something to the effect of "keep it in VB,
JScript, and JScript.NET". Because it's not just in VB.

This topic has been pounded to death. I've written lengthy dissertations on
the topic.

I'm primarily an assembly language, C++ programmer who makes a living doing
VB, who is good in C# and can do Java. Of all the languages I've worked
with, I don't get "stuck" with any particular one. Each has its merits and
its place and proper use. Just another tool in the toolbox. I don't mind
language evolution. But I wouldn't fight toothe and nail to keep a feature
out of a language just because its in an other language I don't want
anything to do with.
Thanks,
Shawn
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:O5*************@tk2msftngp13.phx.gbl...
Elder,

It was determined that with doesn't add anything to the language in
terms of readability (this is an opinion of the language designers). Also, "with" was used as a performance enhancement in VB, but in .NET, the
mechanics are different, and the performance benefit is no longer there.
Finally, given C#'s C/C++ heritage, those languages do not have a "with"
statement, so this influenced the decision as well.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Elder Santos" <pe*******@msn.com> wrote in message
news:uQ****************@TK2MSFTNGP11.phx.gbl...
hi, everyone,
i would like know why c# doesn't have the keyword "with", such as vb does?
Thank u so much;;
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.532 / Virus Database: 326 - Release Date: 27/10/2003


Nov 15 '05 #6

"Shawn B." <le****@html.com> wrote in message
news:uf*************@tk2msftngp13.phx.gbl...
I've many times examined the IL and the final x86 instructions of code made with "with" in VB.NET and it would appear that there are some optimizations, at least in the sense, that it assigns a pointer to a register and then the following uses of the with do some pointer magic with that register, as
opposed to if I don't use the with, every use of the object causes it to
fetch the pointer and then do some pointer magic. It appears there is an
optimization.

"With" is not a pure vb thing, as almost everyone thinks. It's also in
JScript. Though the syntax of it in JScript is horrible, it doesn't use the preceding . (dot). It's never obvious when looking at the code. In VB,
I've never had a problem with a "with". It does indeed add readibility to
the code, an opinion no C# programmers share (probly because they aren't
used to the grammer and they are so think on thinking "its a VB thing and I avoid all VB things.".

My opinion is if you don't like/want "with" in C#, then plea with the
language designers to get rid of the "using" statement as well.

Which using statement? I don't like using aliases, but I do like the using()
statement, please qualify your statements fully.
But the language must evolve, as does all other languages must evolve.
Keeping features out of one just because they exist in another (one you
don't like) is not a good enough reason to keep it out.

I've read the papers from the C# developers explaining why they left it out and quite frankly, I've come to the conclusion that they won't do it because they are too lazy to add it in and because too many C# programmers feel it's a "VB thing" and despise it not based on any lack of merit. Everytime I've seen the argument, they are quick to point out something to the effect of
"keep it in VB". They should say something to the effect of "keep it in VB, JScript, and JScript.NET". Because it's not just in VB.

This topic has been pounded to death. I've written lengthy dissertations on the topic.

Yes it has, and its certainly not needed in C#, it was barely needed in VB
or JScript, it is, at this point, just a syntax feature that doesn't provide
much simplicity(and potentially could cause breaking simplicity, if used
badly)
I'm primarily an assembly language, C++ programmer who makes a living doing VB, who is good in C# and can do Java. Of all the languages I've worked
with, I don't get "stuck" with any particular one. Each has its merits and its place and proper use. Just another tool in the toolbox. I don't mind
language evolution. But I wouldn't fight toothe and nail to keep a feature out of a language just because its in an other language I don't want
anything to do with.
Thanks,
Shawn
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:O5*************@tk2msftngp13.phx.gbl...
Elder,

It was determined that with doesn't add anything to the language in
terms of readability (this is an opinion of the language designers).

Also,
"with" was used as a performance enhancement in VB, but in .NET, the
mechanics are different, and the performance benefit is no longer there.
Finally, given C#'s C/C++ heritage, those languages do not have a "with"
statement, so this influenced the decision as well.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Elder Santos" <pe*******@msn.com> wrote in message
news:uQ****************@TK2MSFTNGP11.phx.gbl...
hi, everyone,
i would like know why c# doesn't have the keyword "with", such as vb does?
Thank u so much;;
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.532 / Virus Database: 326 - Release Date: 27/10/2003



Nov 15 '05 #7

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

Similar topics

5
by: siliconwafer | last post by:
Hi all, I wanted to know that is use of extern keyword mandatory in case of global variables and functions used in other source files? i.e consider a following piece of code from MSDN explaining...
4
by: tzellman | last post by:
Ok, so here is my situation: Let's assume I have a function that makes good use of the kwargs parameter. It requires that there is a certain "format" for the kwargs keywords. (I am using Django,...
33
by: Snis Pilbor | last post by:
With the "as if" rule in play, doesn't that effectively render the "register" keyword completely useless? Example: I make a silly compiler which creates code that goes out of its way to take a...
6
by: tom | last post by:
Hi I try to check whether a given input is keyword or not. However this script won't identify keyword input as a keyword. How should I modify it to make it work? #!usr/bin/env python import...
4
by: Pranjal9880 | last post by:
Hi all I am trying to parse the xml file using perl in which I am succeeded , I am able to fetch the data from the xml file by using one keyword. Now I want to do it using more than one keyword. It...
2
by: rlemusic | last post by:
Hi everybody, I’m creating a database in Access (I believe it’s 2000) to catalogue items in the archives of a small museum. I’m a total n00b as far as using Access goes, but by looking at some...
3
by: Redbeard | last post by:
Hi All this is my first time post, be gentle. I am looking at creating a keyword search that searches multiple fields in a Form and then filters records that match the keyword. The Form...
10
by: Armando Serrano Lombillo | last post by:
Why does Python give an error when I try to do this: Traceback (most recent call last): File "<pyshell#40>", line 1, in <module> len(object=) TypeError: len() takes no keyword arguments but...
1
adelemb
by: adelemb | last post by:
Hi, I'm trying to make a SQL statement work and am getting quite mixed up with it, I hope someone can help! I have a form with a textbox named "keyword". I want the user to enter a keyword and...
1
by: alamodgal | last post by:
hiiiiiii I have a problem in highlighting searching keyword.Actually im using this function for searching Public Function HighLight(ByVal Keyword As String, ByVal ContentFor As String) Dim...
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:
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...
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...
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,...
0
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...

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.