How to dispose a XDocument?

Hello,

I am loading a few XDocuments to read, write, etc.

After using the XDocument can't I dispose it? I think I should or not?
I was looking for it and XDocument does not have a Dispose method.

Thanks,
Miguel
0
shapper
3/15/2010 12:12:55 AM
dotnet.languages.csharp 1931 articles. 0 followers. Follow

1 Replies
1898 Views

Similar Articles

[PageSpeed] 10

On 14-03-2010 20:12, shapper wrote:
> I am loading a few XDocuments to read, write, etc.
>
> After using the XDocument can't I dispose it? I think I should or not?
> I was looking for it and XDocument does not have a Dispose method.

There are no need for it.

XDocument only contains some data structures in managed memory.

And that can be GC'ed - so no need for any Close/Dispose call.

Arne

0
ISO
3/15/2010 12:18:59 AM
Reply:

Similar Artilces:

Fixed Asset disposal
I've added a fixed asset as of 07/01/07 & have depreciated it for July thru Oct. Now I've been told that we should not have added the asset. I want to retire this asset with a disposal date of 07/01/07 with the disposal amount that is the same as the acquisition amount, and have the depreciation entries reverse in the current month. Will it work? ...

Events and Dispose
Anyone put this straight in my head... If you dispose an object that without explicitly removing the event subscription what happens? Does the event still hang there? Does it prevent the Dispose()? If so, what is the point of subbing to an event using an anon. method? Timer timer = new Timer(); timer.Interval = 2000; timer.Tick += (s,e) => { // DO Stuff timer.Dispose(); }; timer.Start(); mick On 6/24/2010 4:36 PM, mick wrote: > If you dispose an object that without explicitly removing the event > subscription > what happens? Do...

If my System.IO.StreamWriter Write method throws "The specified network name is no longer available." and I try to Dispose or Close it in the finaly clause the close or dispose method just throws "The
If my System.IO.StreamWriter Write method throws "The specified network name is no longer available." and I try to Dispose or Close it in the finaly clause the close or dispose method just throws "The specified network name is no longer available." again. how to clean this up? after this the stream writer is stuck connected until i restart my process. ...

Dispose by Group
Hello all, I am designing a database keeping track of books. Books are stored in a box. Tables in the database are designed to keep track of books individually per box, which means I have a field for Box # and book #. Depending on the # of books in each box, the records are varied in the table. Additionally, I have a field for the year of the book (e.g. "2007"), and each box may have books for various years. The company policy is to destroy the books that are 15 years old from the book year by box; however, if there is at least one book in the box that is less than 14 ye...

How to dispose a XDocument?
Hello, I am loading a few XDocuments to read, write, etc. After using the XDocument can't I dispose it? I think I should or not? I was looking for it and XDocument does not have a Dispose method. Thanks, Miguel On 14-03-2010 20:12, shapper wrote: > I am loading a few XDocuments to read, write, etc. > > After using the XDocument can't I dispose it? I think I should or not? > I was looking for it and XDocument does not have a Dispose method. There are no need for it. XDocument only contains some data structures in managed memory. And that can be GC&#...

Disposing issue
Hi there, I'm currently using the following pattern in various place but just realized it's probably not safe. Can someone comment on this: public DataRow GetWhatever() { using (DataTable dataTable = GetDataTable()) { return dataTable[0]; } } The problem is that "DataRow" has a "Table" property that points back to the same "dataTable" in the "using" statement above. That object is disposed of in the "using" statement however so I assume the "Table" property will now point to garbage (...

Fixed Asset
Does anyone know how to dispose of a fixed asset? Natasha, there are a number of different disposal types which may require different inputs to perform. I suggest you click on the Help link in GP and either read the Fixed Asset Help files or review the Printable Manuals under Help. Either of these will guide you through the disposal process. Frank Hamelly MCP-GP, MCT, MVP East Coast Dynamics www.eastcoast-dynamics.com After I retire an asset, is there any way it will show up again? I see it just disappears so what if a person wanted to look at the asset information? "Frank Hamell...

Smartlist-disposed assets
I do NOT want the Smartlist to pick up retired items but I don't want to purge them. Does anyone have a suggestion? -- JeannieC Jeannie - You can try adding the Asset Status column to the SmartList. Then do a Search restriction with the Asset Status field not equal to 'Retired'. -- This posting is provided "AS IS" with no warranties, and confers no rights. "Jeannie" wrote: > I do NOT want the Smartlist to pick up retired items but I don't want to > purge them. Does anyone have a suggestion? > -- > JeannieC Kim...The Asset Status is ...

Sequence of Depreciation and Disposal
Hi, I know that best practice should be dispose the asset first and then run the regular depreciation. However, I did it in a reverse way. What is the impact of doing it reversely. We use the half -year convention. Is the system smart enought to recover the excessive half year depreciation when I depreciate first and then dispose? Thanks, Well, a quick way to tell is look at the entries created by the disposal. I haven't tested your scenario, but I'm guessing GP will correctly calculate the NBV of the disposed asset. Hope this helps, Frank Hamelly MCP-GP, MCT, MVP East C...

auto dispose objects?
Hi, i am develoing a wireless network simulator for my university thesis. the thing i cannot do is the message transmission. the transmitter releases a message to air, and the receivers in the range grab it. i have a message object that is saved into an array and can be visible to nearby devices. this message should be visible for a short time. how can i make the object auto disposed in a default timeout? i need a quick help pls, thanks, --- Tahir On 2010-01-04, Tahir <kurkcutahir@windowslive.com> wrote: > Hi, > i am develoing a wireless network simulator f...

Default namespace, prefix and XDocument
Hi all I have the following code: Namespace ns = "http://www.abc.com"; XDocument xDoc = new XDocument( new XElement(ns + "root", new XElement("person", new XAttribute("id", 1), new XElement("forename", "jack"), new XElement("age", 35)), new XElement("person", new XAttribute("id", 2), new XElement("for...

disposable email address service?
Is there a disposable email address service that integrates with outlook to some degree so I don't have to log-in via a browser to generate a new address? Plus, after using a web site to generate different addresses, I found it hard to keep track which address was given to whom. Although the service I use allows me to attach a note to each email address, there is no way to quickly view the list of addresses and the notes attached to them. I have to drill down each address to see the note, and doing this over a web site is painfully slow. Google is your friend. -- Milly Staple...

Disposal of Greetings 2002 for Windows XP
Is there anyone now using Publisher who might have a no longer used Greetings 2002 they would like to dispose of? It must not have a OEM product ID No. or I shall not be able to transfer it to my Windows XP computer. Many thanks. Sybil Fox I have it but it is an OEM version. Try eBay. -- JoAnn Paules MVP Microsoft [Publisher] "Sybil Fox" <shfox@worldonline.co.uk> wrote in message news:ueI2hCkpFHA.708@TK2MSFTNGP09.phx.gbl... > Is there anyone now using Publisher who might have a no longer used > Greetings 2002 they would like to dispose of? It must not hav...

Smartlist & disposed assets
Is there a way to run the Smartlist without including the disposed of items? I don't want to purge them but do NOT want them included when I run a list. Are there plans, I hope, for being able to view assets and depreciation as of a particular date, versus the only choice now being current depreciation? -- JeannieC The Fixed Assets SL item can be searched to exclude items with status of Retired. Unfortunately, the Fixed Assets Books item cannot be similarly restricted. SmartList Builder could be used to create a SL item that did not include retired assets. "Jeannie" &l...

Partial fixed asset disposed
A fixed asset was only partially disposed of. A 2nd asset got created but it seems to just be sitting out there. Do I need to do a "undo retire" to get back to the original asset in order to correctly retire the entire asset? I would like to get rid of the 2nd asset that got created. Thanks ...

How to show child form with cannot access a dispose object error
Hi, I have child form attached to a parent form. It is declare in parent form. private frmChild child; I also have an event to show the form and activate it. if (this.child == null) { this.child = new frmChild(); this.child.MdiParent = this; } this.child.Show(); this.child.Activate(); No problem when called for the very first time to show the child form. Problem occurs when the child from is closed and the called again to show. "Cannot access a dispose object" error occurs on .Show() line. I do not want to just hide the child form. Can I completely d...

theorycal doubt about form and disposing
Hello, I have a big doubt. I create a project with 2 forms: form1 and form2 and i place a button on form1 in click event i write Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim a As New Form2 a.ShowDialog() a.Dispose() a.ShowDialog()'<- I get error because a doesn't exist anymore End Sub if I write Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click form2.ShowDialog() form2.Dispose() form2.ShowDialog()' It continues working .........

Object disposal guidance needed
Hi all. I'm a recent migrant from VB6 so I'm used to creating references to objects and then setting them to Nothing when they are no longer needed. Do I understand correctly that setting to Nothing is unnecessary in VB 2008 when the owning class or form is about to close anyway? Can disposal of objects always be left to the garbage collector, or are there times when setting to Nothing would be useful or desirable? Second, though related, question: when showing a form, using ..ShowDialog, I always call the form's .Dispose method on return. Should I set the form ...

Dispose variables to free memory
Hello, I don't get it how to use Dispose in ASP.NET 1.1. On MyClass, I put my own Dispose procedure. I instance MyClass as oMyClass, I use it and after I finish, I call oMyClass.Dispose, looking for releasing memory. Repeater1 stores and shows properties from oMyClass. But after doing oMyClass.Dispose, Repeater1 shows oMyClass.properties with no value - Am I doing wrong the dispose function? - If leave Dispose method on MyClass and don't call it, will .NET still dispose all variables or not? 'On my aspx code behind I put: '''' Code behind myA...

Fixed Asset disposal
I have closed the fixed asset module for our company as of 07/31/08. A disposal dated 07/31/08 is entered. When we run the posting report for the period 2009-01, the disposal does not show up, but if we runs it for the date of 2008-12 the disposal appears as shown below. Under the <book setup> the Accounting books’ current year is 2009. What is the problem? Thanks No problem Merle, the system is reflecting the date you did the retirement on and is independent of what Accounting year you are in. Here's what happens when you close the FA year: 1. Zeros will be displayed i...

errors when closing and disposing SqlConnection in DLL
I have inherited and application originally written in C# for .net 1.1. I am currently looking into upgrading it to .net 3.51. Everything seems to be working smoothly except we have a core DLL that we use to maintain our SQL connection. Everytime we open a page it calls this .dll to establish a SQL connection and then this connection is passed to our other DLLs that do the actual data queries. This has been working fine under 1.1 but now that I have converted to 3.51 it throws one of the two following messages: aspnet_wp.exe 5160 system.invalidoperationexception - when I just ac...

CA2000 Warning call Dispose on object
Hello, I get a CA2000 warning on the following code. public class Taskbar { private static Taskbar _default; private bool _isSynchronized; public static Taskbar Default { if (_default == null) { _default = Taskbar.Synchronized(new Taskbar()); } return _default; } public static Taskbar Synchronized(Taskbar taskbar) { taskbar._isSynchronized = true; return taskbar; } } Can somebody explain me how to resolve the CA2000 warnings on the code? Regards, Fred za wr...

Dispose of ADODB.Recordset with VB Express 2008
Hi, I've used the VB Express upgrade feature to transform code from VB6 to VB Express 2008 Part of my original code included: <Code> Dim RS As New ADODB.Recordset Set RS = Nothing RS.Open("SELECT DISTINCT GENUS FROM Plants ORDER by GENUS;", ogAccess) </Code> The translated code included: <Code> 'UPGRADE_NOTE: Object RS may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6E35BFF6-CD74-4B09-9689-3E1A43DF8969"' RS= Nothing </Code...

implement xdocument timeout
Im using a xDocument with Linq to get the last 10 blog entries. Like this: XDocument xDocument = XDocument.Load("SOMEURL"); var linq = from itens in xDocument.Root.Elements("channel").Elements("item").Take(10) select new { title = (string)itens.Element("title"), link = (string)itens.Element("link") }; rptBlogFeed.DataSource = linq; rptBlogFeed.DataBind(); The problem: I already got the blog feed (third-apart) offline a few times, and when it ocours, if the site is not cached, the user gets a error. I have encapsulated the cod...

Correctness of Message Disposal Notifications in Outlook Express 5.50.4522.1200
Hi, I am wondering if Outlook Express creates correctly the Message Disposal Notifications. When Outlook Express receives a message for which a Reply is Requested, it pops up with a window saying "The message sender has requested a response to indicate that you have read this message. Would you like to send a receipt ?" Answering yes creates, first locally, a MDN to be sent to originator of the message. There is an attachement with this MDN which has the following content : "Final-Recipient: rfc822;vda_detal@hotmail.com Original-Message-ID: <Law10- OE58BbKP7Ie8t000...