清除c#中的xml文件数据 [英] clearing data of xml file in c#
问题描述
您好!我的xml文件有问题。是的,我在c#中有一个网站。我有一个多用户聊天应用程序。我将每条聊天消息存储在xml文件中。现在的问题是,每当我重新启动应用程序时,所有以前的消息都会出现在聊天的列表框中。无论如何,每次关闭应用程序时我都需要清除xml文件的内容。
谢谢。
P.S我认为一个解决方案是删除xml文件eveytime我关闭应用程序,并在每次重新启动它时再次创建它。使用global.asax页面的Application_Start和Application_End。这样可以吗?
我很着急。 :)
hello! I have a problem with xml file. It is, I have a website in c#. in which I have a multiuser chat application. I store every chat messages in a xml file. Now the problem is, whenever I restart the application, all the previous messages appear in the listbox of the chat. By anyhow, I need to clear the contents of xml file everytime I close the application.
Thank you.
P.S I think one solution is to delete xml file eveytime I close the application, and to create it again everytime I start it again. using global.asax page''s Application_Start and Application_End. Is it possible by this way?
PLease I am in hurry. :)
推荐答案
PS我认为一种解决方案是删除xml文件eveytime我关闭应用程序,并在每次重新启动时再次创建它。
P.S I think one solution is to delete xml file eveytime I close the application, and to create it again everytime I start it again.
这样可行。
您也可以在应用程序启动时删除该文件(并重新创建)。
This would work.
You may also delete the file (and create it again) at application startup.
这篇关于清除c#中的xml文件数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!