|
by: Russell Mangel |
last post by:
Is it possible to use the using statement with XmlTextReader?
I tryed to use it, but it gives me the error message:
Cannot implicitly convert type 'System.Xml.XmlTextReader' to
'System.IDisposable'
Is there something I am doing wrong?
// This no worky
using(XmlTextReader xtr = new XmlTextReader("C:\\myfile.xml"))
{
|
by: Bill Priess |
last post by:
Hey gang,
Ok, I'm stumped on this one... I am using the using statement to wrap a
SqlDataAdapter that I am using to fill a DataTable. Now, what I need to know
is, just how much block-scope applies to objects created in the using scope.
For example:
<code>
static DataTable getTable()
|
by: Kepler |
last post by:
I have a situation where I need to use a Using statement that creates
some records in a database. After that completes, if it completes, I
need to do some file creation. Any code I'm putting after the Using
statement gives a compiler warning of "Unreachable Code Detected", and
it never runs.
Why is this happening? I really don't want to put the file
manipulation code in the using statement because it's a transaction.
I also need for...
|
by: J-T |
last post by:
I have a class like below I have a couple of questions about that:
1) I like to use "Using statement" when creating an object of this class,so
I had to implement IDisposable.Am I doing this right here?
2) Do I have to be worried about those objects I have created in
GetPackageNames() ?? for instance making them null afterward or something?
3) This class is in my business layer As you can see I'm using
Microsoft.SQLServer.DTSPkg80...
|
by: pascal_pare |
last post by:
Hi,
Is there a way to declare a using statement with the CodeDom?
Something like:
using (obj = new Object())
{
obj.DoSomething;
}
|
|
by: Trevor |
last post by:
I have seen the "using" statement used in strange ways in some C# code.
Example:
using (StreamReader sr = new StreamReader("TestFile.txt"))
{
// do some stuff...
}
What effect does the using statement give you in this example?
|
by: Robert Bravery |
last post by:
Hi all,
Being new to C# and .net I often don't know how to use things.
I have created an app that imports excel data, it works well, with methods
to open excel, extract the data and close excel.
Now a colege of mine suggested useinf the usingstatement, so that the office
object is dispossed/destroyued correctly, saying that it prevents
memoryleaks. Problem is I am having problems trying to achieve this, I keep
getting the error:
type...
|
by: Juan Zamudio |
last post by:
Hi all, I'm using vs 2003, i have a question about using and as, i was
reading in programing .net components that one way to avoid null
references inside using was using as, something like this:
using(var as IDisposable){
.....
}
the book saids that if the conversion is null the code inside using will
not run, but i cant make it work, I have a FileStream that opens a file,
the path is a parameter, something like this:
|
by: Hillbilly |
last post by:
MSDN Remarks "as a rule" the using statement should be used when
instantiating objects which inherit IDisposable. Other than the obvious
unmanaged objects like the file system example, fonts and the database how
else may it be determined which classes and their objects inherit
IDisposable?
And the remarks imply the using statement is a different and perhaps more
efficient way to use objects than try-catch-finally?
...
|
by: CSharper |
last post by:
I have a using statement something like the following
try
{
using(SqlConnection cnn = ...)
{
}
catch(Exception e1)
{
}
|
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...
|
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
|
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
|
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...
|