473,789 Members | 2,516 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

About references and/or the use of the using keyword...

When using Visual Studio.NET I observe adding a new Web Form may have
default References added such as...

References
o- System
o- System.Data
o- System.Drawing
o- System.Web
o- System.XML

The source code will often contain what seems to be redundant declarations
as follows...

using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.XML;

Is there any reason References and what is declared in the code-behind
should be synchronized? Is there in fact redundantcy in this context?

Finally, when converting a VB project that has a Reference to
Microsoft.Visua lBasic is it sufficient to declare the use of the equivalent
namespace by using Microsoft.CShar p; declared in the code-behind? I could
not find any 'reference' to Microsoft.CShar p when trying to 'Add Reference.'

<%= Clinton Gallagher
Nov 16 '05 #1
4 4584

"clintonG" <cs*********@RE MOVETHISTEXTmet romilwaukee.com > wrote in message
news:uz******** ******@tk2msftn gp13.phx.gbl...
When using Visual Studio.NET I observe adding a new Web Form may have
default References added such as...

References
o- System
o- System.Data
o- System.Drawing
o- System.Web
o- System.XML

The source code will often contain what seems to be redundant declarations
as follows...

using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.XML;

Is there any reason References and what is declared in the code-behind
should be synchronized? Is there in fact redundantcy in this context?
The using directive has nothign to do with references, it simply provides a
list of namespaces the compiler should consider when trying to resolve an
identifier to a type name.

using System;

means the compiler should consider Int32 as both Int32 and System.Int32. It
picks the one that exists and fails if more than one exists.

References are a totally different beast, they define assemblies you want to
import. What you are seeing here is that many assemblies have the same name
as the namespaces they contain.

Finally, when converting a VB project that has a Reference to
Microsoft.Visua lBasic is it sufficient to declare the use of the
equivalent
namespace by using Microsoft.CShar p; declared in the code-behind? I could
not find any 'reference' to Microsoft.CShar p when trying to 'Add
Reference.'


Microsoft.Visua lBasic.dll is an assembly which contains a large number of VB
support classes. VB's intrinsic functions are implemented in that dll.
System.dll also implements a couple classes in the namespace
Microsoft.Visua lBasic, pretty much the same as it does for Microsoft.CShar p.

There is no Microsoft.CShar p assembly. The only Microsoft.CShar p namespace I
know of is contained in System.dll.
Nov 16 '05 #2
Thanks for your comments Daniel.
I'm working on the conversion of a VB.NET app that includes a rerence to
Microsoft.Visua lBasic.
This ASP.NET application functions as a dynamic process controller, i.e. a
wizard.

MSDN documentation describes both Microsoft.CShar p and Microsoft.Visua lBasic
as namespaces that.

"...contain classes that support compilation and code generation..."

So it seemed the presence of the reference for the Microsoft.Visua lBasic
namespace in the VB.NET application had relevance but removing that
reference, recompiling and running in debug mode results in a stable
application regardless. Hmmm?
<%= Clinton Gallagher
"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:eD******** ******@tk2msftn gp13.phx.gbl...

"clintonG" <cs*********@RE MOVETHISTEXTmet romilwaukee.com > wrote in message
news:uz******** ******@tk2msftn gp13.phx.gbl...
When using Visual Studio.NET I observe adding a new Web Form may have
default References added such as...

References
o- System
o- System.Data
o- System.Drawing
o- System.Web
o- System.XML

The source code will often contain what seems to be redundant declarations as follows...

using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.XML;

Is there any reason References and what is declared in the code-behind
should be synchronized? Is there in fact redundantcy in this context?
The using directive has nothign to do with references, it simply provides

a list of namespaces the compiler should consider when trying to resolve an
identifier to a type name.

using System;

means the compiler should consider Int32 as both Int32 and System.Int32. It picks the one that exists and fails if more than one exists.

References are a totally different beast, they define assemblies you want to import. What you are seeing here is that many assemblies have the same name as the namespaces they contain.

Finally, when converting a VB project that has a Reference to
Microsoft.Visua lBasic is it sufficient to declare the use of the
equivalent
namespace by using Microsoft.CShar p; declared in the code-behind? I could not find any 'reference' to Microsoft.CShar p when trying to 'Add
Reference.'

Microsoft.Visua lBasic.dll is an assembly which contains a large number of

VB support classes. VB's intrinsic functions are implemented in that dll.
System.dll also implements a couple classes in the namespace
Microsoft.Visua lBasic, pretty much the same as it does for Microsoft.CShar p.
There is no Microsoft.CShar p assembly. The only Microsoft.CShar p namespace I know of is contained in System.dll.

Nov 16 '05 #3

"clintonG" <cs*********@RE MOVETHISTEXTmet romilwaukee.com > wrote in message
news:eq******** ******@TK2MSFTN GP14.phx.gbl...
Thanks for your comments Daniel.
I'm working on the conversion of a VB.NET app that includes a rerence to
Microsoft.Visua lBasic.
This ASP.NET application functions as a dynamic process controller, i.e. a
wizard.

MSDN documentation describes both Microsoft.CShar p and
Microsoft.Visua lBasic
as namespaces that.

"...contain classes that support compilation and code generation..."

So it seemed the presence of the reference for the Microsoft.Visua lBasic
namespace in the VB.NET application had relevance but removing that
reference, recompiling and running in debug mode results in a stable
application regardless. Hmmm?


It might have had uses, if the VB code used VB intrinsics (InStr or Left for
example). The converter may have fixed that.
Nov 16 '05 #4
I pored over the VB source and used Tangible's Instant C# [1] for snippet
conversions -- it is quite good I might add -- I am not that conversant with
mapping the superfluous VB keywords and grammar but I'm sure getting there
the hard way.

As it turns out, I just learned how useful the call stack can be as it
helped me determine I had not initialized the PreRender event and this
conversion is now complete. The application is a process controller, i.e. a
wizard, and now I need to focus on extending its use of interfaces. Whoopee
:-)

<%= Clinton Gallagher

[1] http://tangiblesoftwaresolutions.com/


"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..

"clintonG" <cs*********@RE MOVETHISTEXTmet romilwaukee.com > wrote in message
news:eq******** ******@TK2MSFTN GP14.phx.gbl...
Thanks for your comments Daniel.
I'm working on the conversion of a VB.NET app that includes a rerence to
Microsoft.Visua lBasic.
This ASP.NET application functions as a dynamic process controller, i.e. a wizard.

MSDN documentation describes both Microsoft.CShar p and
Microsoft.Visua lBasic
as namespaces that.

"...contain classes that support compilation and code generation..."

So it seemed the presence of the reference for the Microsoft.Visua lBasic
namespace in the VB.NET application had relevance but removing that
reference, recompiling and running in debug mode results in a stable
application regardless. Hmmm?

It might have had uses, if the VB code used VB intrinsics (InStr or Left

for example). The converter may have fixed that.

Nov 16 '05 #5

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

Similar topics

4
2849
by: cppsks | last post by:
I have been working on making a constant array available for the clients. However, it is placing it in the text segment, and external references result in unresolved references to the array. Taking the const off the definition solves the problem (the variable is placed in the data segment). Is this how const globals are supposed to work, or did the linker screw up? Thanks.
5
2101
by: Zach | last post by:
When it is being said that, "value types are created on the stack or inline as part of an object". If a value type is created in an object, and that object is being called, the value type in that object, is still created on the stack, I would say, so I don't understand this inline business. Apart from the fact that it is my understanding that "inline" as it exists in C++ doesn't exist in C#. Could someone please shed some light on this...
2
1662
by: vineoff | last post by:
When you should not or can't use const references? Like void f ( const Foo& b) ; or int main() { const int& r = 5; }
66
3743
by: KimmoA | last post by:
Hey! Some questions about C that have been bugging me for a while... 1) Is inline a valid C keyword or not? I was kind of surprised of not finding it in C, to be honest. My "The C Programming Language" book doesn't mention it. 2) I understand that C doesn't care about whitespace that much, but why did they make it impossible to use the minus ('-') char in variable names? I now have to incorrectly name my "hi-score" variable "hiscore"....
22
1663
by: mehdi_mousavi | last post by:
Hi folks, Consider the following line of code: Address addr = ei.Address; where ei is an instance of a class that has got a property of Address type. The question is that what is happening in the above assignment? Unlike the C/C++, it seems that the above code instructs the compiler to point
6
2481
by: Shailen Sukul | last post by:
Observed a weird behaviour with object references. See code listing below: using System; using System.Collections.Generic; using System.Text; namespace PointerExceptionTest { /*
14
2402
by: Philipp Reif | last post by:
Hi all, I've got a little hole in my head concerning references. Here's what I'm trying to do: I'm calling a function, passing the reference of a business object for editing. The function clones the object, calls an editor dialog to let the user edit the object, and then - depending on the DialogResult - assigns either the clone/backup copy or the modified object itself to the reference. Maybe I'm thinking too much in pointer references...
6
1828
by: Murray Hopkins | last post by:
Hi. THE QUESTION: How do I get a reference to my Object when processing an event handler bound to an html element ? CONTEXT: Sorry if it is a bit long. I am developing a JS calendar tool. One of the requirements is that the calendar will need to display a varying number of months (1..3)
4
1381
by: Frankie | last post by:
The following questions are with respect to this delegate declaration: delegate void MyDelegate(string s); Question 1: Why does the following NOT work? Why can't I just create a new instance of MyDelegate that references zero methods? MyDelegate d; d = new MyDelegate();
0
9663
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10195
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9016
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6765
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5415
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4090
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 we have to send another system
3
2906
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.