久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <bdo id='qTsjZ'></bdo><ul id='qTsjZ'></ul>

  • <tfoot id='qTsjZ'></tfoot>
      <i id='qTsjZ'><tr id='qTsjZ'><dt id='qTsjZ'><q id='qTsjZ'><span id='qTsjZ'><b id='qTsjZ'><form id='qTsjZ'><ins id='qTsjZ'></ins><ul id='qTsjZ'></ul><sub id='qTsjZ'></sub></form><legend id='qTsjZ'></legend><bdo id='qTsjZ'><pre id='qTsjZ'><center id='qTsjZ'></center></pre></bdo></b><th id='qTsjZ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='qTsjZ'><tfoot id='qTsjZ'></tfoot><dl id='qTsjZ'><fieldset id='qTsjZ'></fieldset></dl></div>

    1. <small id='qTsjZ'></small><noframes id='qTsjZ'>

      <legend id='qTsjZ'><style id='qTsjZ'><dir id='qTsjZ'><q id='qTsjZ'></q></dir></style></legend>

        如何修復有小數分隔符問題的應用程序

        How to fix an application that has a problem with decimal separator(如何修復有小數分隔符問題的應用程序)
      1. <small id='8RAyG'></small><noframes id='8RAyG'>

            • <tfoot id='8RAyG'></tfoot>

              <legend id='8RAyG'><style id='8RAyG'><dir id='8RAyG'><q id='8RAyG'></q></dir></style></legend>
            • <i id='8RAyG'><tr id='8RAyG'><dt id='8RAyG'><q id='8RAyG'><span id='8RAyG'><b id='8RAyG'><form id='8RAyG'><ins id='8RAyG'></ins><ul id='8RAyG'></ul><sub id='8RAyG'></sub></form><legend id='8RAyG'></legend><bdo id='8RAyG'><pre id='8RAyG'><center id='8RAyG'></center></pre></bdo></b><th id='8RAyG'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='8RAyG'><tfoot id='8RAyG'></tfoot><dl id='8RAyG'><fieldset id='8RAyG'></fieldset></dl></div>
              • <bdo id='8RAyG'></bdo><ul id='8RAyG'></ul>
                    <tbody id='8RAyG'></tbody>

                  本文介紹了如何修復有小數分隔符問題的應用程序的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  這篇文章是關于 C# 和 .Net 的,但有些信息對其他技術很有價值.

                  從我記事起,我就一直遇到應用程序或游戲因解析十進制數的不同方式而崩潰的問題.它經常發生,從 CAD 應用程序、庫到網頁.不知道是無知還是缺乏見識,但真的很煩人.

                  有什么問題?.它告訴我390159851.超過一百萬的數字很難閱讀,數量級是多少?是 3900 萬還是 390?

                • Mirosoft XNA for Windows Phone 7 示例:有是一個非常簡潔的類,可以解析 XML 文件以生成 XNA 動畫

                  ///<總結>///從 xml 文件加載動畫設置.///</總結>私人無效 LoadAnimiationFromXML(){XDocument 文檔 =XDocument.Load("內容/紋理/AnimationsDefinition.xml");XName 名稱 = XName.Get("定義");var 定義 = doc.Document.Descendants(name);if (animationDefinition.Attribute("Speed") != null){animation.SetFrameInvterval(TimeSpan.FromMilliseconds(double.Parse(animationDefinition.Attribute("Speed").Value)));}

                  double.Parse 拋出異常,一個簡單的方法是使用 XmlConvert.ToDouble(); 或使用 InvariantCulture 解析.

                • .Net 應用程序使用 CSV 文件將輸入向量存儲為 CSV - 也會拋出.

                • 另一個在類中有一些解析的 .Net 應用程序 - throws.

                • 那么我們該如何解決這個問題呢?

                  • 修復代碼中的錯誤 - 只能使用可用的源代碼且繁瑣.
                  • 更改數據(CVS、XML 等) - 即使有可能,但對更改數據不太滿意.
                  • 更改操作系統默認的小數點分隔符 - 不會發生.

                  還有其他方法可以解決這個問題嗎?我可以讓應用保持不變嗎?就像在不同的環境中啟動應用一樣.

                  PS.我想運行應用程序,但我沒有代碼.

                  解決方案

                  正確設置Thread.CurrentThread.CurrentCulture就不會出現這樣的問題.閱讀此處如何編寫與文化無關的代碼.

                  如果您無權訪問代碼,則可以在具有預期文化集的用戶帳戶下運行應用程序.為了快速訪問,您可以創建一個英語用戶、一個德語用戶、一個法語用戶..

                  This post is about C# and .Net, but some info is valuable for other techonolgies.

                  Since I can remember, I've been having problems with apps or games that crash because of a different style of parsing decimal numbers. It happens very often, from CAD apps, libraries to web pages. I'm not sure whether it is ignorance or lack of knowledge, but it's really annoying.

                  What's the problem? Here is a wiki article about it, but it short:

                  Here is a map that shows what kind of decimal separator (decimal mark) is used around the world.

                  Decimal marks:

                  • Period — Blue
                  • Comma — Green
                  • Non-West-Arabic Numerals — Red
                  • Unknown — Grey

                  Most of the Europe, South America write 1 000 000,00 or 1000000,00 sometimes 1.000.000,00 as opposite to "imperial" (marked as blue) write 1,000,000.00

                  Let me just give you a few from all problems that I encoutered last month.

                  1. Number on webpages hard to read: Let's take one of the most viewed YT videos. It shows me 390159851. Number above one million are very hard to read, what's the order of magnitude? Is it 39 mln or 390?
                  2. Mirosoft XNA for Windows Phone 7 example: There is a very neat class that parse XML file to produce XNA animation

                    /// <summary>
                    /// Loads animation setting from xml file.
                    /// </summary>
                    private void LoadAnimiationFromXML()
                    {
                        XDocument doc = 
                                  XDocument.Load("Content/Textures/AnimationsDefinition.xml");
                        XName name = XName.Get("Definition");
                        var definitions = doc.Document.Descendants(name);
                    
                    
                            if (animationDefinition.Attribute("Speed") != null)
                            {
                                animation.SetFrameInvterval(TimeSpan.FromMilliseconds(
                                    double.Parse(animationDefinition.Attribute("Speed").Value)));
                            }
                    

                    double.Parse throws an exception, one simple soultion is to use XmlConvert.ToDouble(); or parse with InvariantCulture.

                  3. .Net app that use CSV files to store input vector as CSV - also throws.

                  4. Another .Net app that has some parsing inside the class - throws.

                  So how can we fix this?

                  • Fix the bug in code - possible only with avaible source code and tedious.
                  • Change the data (CVS, XML etc.) - even with possible, not very happy with mutating the data.
                  • Change the OS default decimal separator - not gonna happen.

                  Is there any other way to slove this? Can I make the app be invariant? Like starting the app in a different environment.

                  PS. I would like to run the app, but I don't have the code.

                  解決方案

                  Properly set Thread.CurrentThread.CurrentCulture and you wont have such problems. Read here how to write culture independent code.

                  EDIT: If you do not have access to the code, you can run the application under a user account which has the expected culture set. For quick access you could create an english user, a german user, a french user..

                  這篇關于如何修復有小數分隔符問題的應用程序的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Ignore whitespace while reading XML(讀取 XML 時忽略空格)
                  XML to LINQ with Checking Null Elements(帶有檢查空元素的 XML 到 LINQ)
                  Reading XML with unclosed tags in C#(在 C# 中讀取帶有未閉合標簽的 XML)
                  Parsing tables, cells with Html agility in C#(在 C# 中使用 Html 敏捷性解析表格、單元格)
                  delete element from xml using LINQ(使用 LINQ 從 xml 中刪除元素)
                  Parse malformed XML(解析格式錯誤的 XML)

                • <legend id='04Uub'><style id='04Uub'><dir id='04Uub'><q id='04Uub'></q></dir></style></legend>
                    <bdo id='04Uub'></bdo><ul id='04Uub'></ul>
                      <i id='04Uub'><tr id='04Uub'><dt id='04Uub'><q id='04Uub'><span id='04Uub'><b id='04Uub'><form id='04Uub'><ins id='04Uub'></ins><ul id='04Uub'></ul><sub id='04Uub'></sub></form><legend id='04Uub'></legend><bdo id='04Uub'><pre id='04Uub'><center id='04Uub'></center></pre></bdo></b><th id='04Uub'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='04Uub'><tfoot id='04Uub'></tfoot><dl id='04Uub'><fieldset id='04Uub'></fieldset></dl></div>

                        <tbody id='04Uub'></tbody>

                      <small id='04Uub'></small><noframes id='04Uub'>

                      • <tfoot id='04Uub'></tfoot>
                          1. 主站蜘蛛池模板: 中文字幕在线欧美 | 精品一区二区三区不卡 | 毛片久久久| 国内自拍视频在线观看 | 亚洲一区二区精品视频 | 先锋影音资源网站 | www日本在线观看 | 中文字幕在线一区二区三区 | 8x国产精品视频一区二区 | 久久免费看| 亚州精品成人 | 在线成人免费视频 | 日韩一 | 美国av片在线观看 | 91精品国产色综合久久不卡98 | 99精品国自产在线 | 国产一级片一区二区三区 | 欧美日韩一区精品 | 国产第一区二区 | 中文字幕综合 | 天天干,夜夜操 | 性高朝久久久久久久3小时 av一区二区三区四区 | 日韩中文字幕 | 国产高清视频在线观看 | 久久久久91| 亚洲国产aⅴ成人精品无吗 亚洲精品久久久一区二区三区 | 色婷婷综合在线观看 | 日本在线你懂的 | 99精品视频在线 | 91欧美精品成人综合在线观看 | 亚洲视频在线播放 | 天天影视色综合 | 99国产精品99久久久久久 | 国产精品视频导航 | 欧美一区视频 | 国产成人精品一区二区三区四区 | 波多野结衣在线观看一区二区三区 | 欧美日韩1区2区3区 欧美久久一区 | 亚洲永久免费观看 | 男人av在线播放 | 久久久久久久久久久久久9999 |