在appconfig中存储float [英] storing float in appconfig

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

问题描述

嗨专家,



我们都知道如何使用项目属性的属性选项卡在app.config中存储应用程序配置数据。今天我尝试在那里存放浮动,可由用户更改。



输入 0.2 后我遇到了一条错误消息,说0.2无法转换为浮动的实例(德语,包括粗语法)。





如何在app.config中存储介于0和1之间的值?

解决方案

出现该消息是因为您使用的是德语版的Visual Studio,而您是尝试用英语输入价值。



如果您使用的是德语版本的Windows,并且您的软件只能在德国安装,那么使用数字是没有意义的英文格式,但如果没有,你有两个解决方案两个解决这个问题:



1.使用字符串值,如0.2代替浮动,然后在您的逻辑中转换为您想要的。(我建议您使用第一个解决方案,因为更灵活!)



2.输入VS值在德语风格,如 0 ,然后在相关的app.config中你可以用英语 0.2

Hi experts,

we all know how to store application configuration data in app.config using the "Properties" tab of a project's properties. Today I tried to store a float there, changeable by user.

Upon entering 0.2 I am confronted with an error message saying that "0.2" cannot be converted to an instance of the "float" (in German, including the crude grammar).


How can I store values between 0 and 1 in app.config?

解决方案

The message occurred because you are using German version of Visual Studio, and you are trying to input value in English.

If you are using German version of the Windows, and your software is designed to be installed only in Germany make no sense to use numbers in English format, but if not you have two solution two solve this:

1.Use string value like "0.2" in place of "float", then in your logic converted as you want.(I recommend you to use this first solution, because is more flexible!)

2.Input in VS the value in German style like 0,2 then in the associated app.config you could change the value (as you want) in English 0.2


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

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