在c#项目中存储数据 [英] Storing a data in the c# project

查看:91
本文介绍了在c#项目中存储数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨..可以永久存储我项目中的数据吗?例如在设置中我在运行时保存一个值,但在关闭项目后,保存的数据不在属性设置中。

因此可以在我的项目中存储一个常量值运行时,即使在我关闭项目并重新启动项目后该值也应该可用。请提供代码或进程???

解决方案

您可以存储app.config文件中的值



< configuration> 
< appsettings>
< add key = countoffiles = 7 />
< add key = logfilelocation = abc.txt />
< / appsettings >
< / configuration >


尝试使用C#进行对象序列化 [ ^ ]

Hi..it is possible to store a data in my project permanently? for example in settings i am saving a value in the run time but after closing the project the saved data is not in the properties settings.
so it is possible to store a constant value in my project in the run time and that value should be available even after i close the project and restart the project.Please provide me the code or process???

解决方案

You can store that value in app.config file

<configuration>
  <appsettings>
    <add key="countoffiles" value="7" />
    <add key="logfilelocation" value="abc.txt" />
  </appsettings>
</configuration>


Try Object Serialization using C#[^]


这篇关于在c#项目中存储数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆