當前位置: 首頁>>代碼示例>>C#>>正文


C# Globalization.CultureData類代碼示例

本文整理匯總了C#中System.Globalization.CultureData的典型用法代碼示例。如果您正苦於以下問題:C# CultureData類的具體用法?C# CultureData怎麽用?C# CultureData使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CultureData類屬於System.Globalization命名空間,在下文中一共展示了CultureData類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: TextInfo

 //////////////////////////////////////////////////////////////////////////
 ////
 ////  TextInfo Constructors
 ////
 ////  Implements CultureInfo.TextInfo.
 ////
 //////////////////////////////////////////////////////////////////////////
 internal unsafe TextInfo(CultureData cultureData)
 {
     _cultureData = cultureData;
     _cultureName = _cultureData.CultureName;
     _textInfoName = _cultureData.STEXTINFO;
     FinishInitialization(_textInfoName);
 }
開發者ID:kouvel,項目名稱:coreclr,代碼行數:14,代碼來源:TextInfo.Unix.cs

示例2: RegionInfo

        [System.Security.SecuritySafeCritical]  // auto-generated
        public RegionInfo(String name) {
            if (name==null)
                throw new ArgumentNullException("name");

            if (name.Length == 0) //The InvariantCulture has no matching region
            { 
                throw new ArgumentException(Environment.GetResourceString("Argument_NoRegionInvariantCulture"));
            }
            
            Contract.EndContractBlock();

            //
            // First try it as an entire culture. We must have user override as true here so
            // that we can pick up custom cultures *before* built-in ones (if they want to
            // prefer built-in cultures they will pass "us" instead of "en-US").
            //
            this.m_cultureData = CultureData.GetCultureDataForRegion(name,true);
            // this.m_name = name.ToUpper(CultureInfo.InvariantCulture);

            if (this.m_cultureData == null)
                throw new ArgumentException(
                    String.Format(
                        CultureInfo.CurrentCulture,
                        Environment.GetResourceString("Argument_InvalidCultureName"), name), "name");


            // Not supposed to be neutral
            if (this.m_cultureData.IsNeutralCulture)
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidNeutralRegionName", name), "name");

            SetName(name);
        }
開發者ID:l1183479157,項目名稱:coreclr,代碼行數:33,代碼來源:RegionInfo.cs

示例3: TextInfo

 internal TextInfo(CultureData cultureData)
 {
     this.m_cultureData = cultureData;
     this.m_cultureName = this.m_cultureData.CultureName;
     this.m_textInfoName = this.m_cultureData.STEXTINFO;
     this.m_dataHandle = CompareInfo.InternalInitSortHandle(this.m_textInfoName);
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:7,代碼來源:TextInfo.cs

示例4: RegionInfo

        [System.Security.SecuritySafeCritical]  // auto-generated
        public RegionInfo(String name)
        {
            if (name == null)
                throw new ArgumentNullException("name");

            if (name.Length == 0) //The InvariantCulture has no matching region
            {
                throw new ArgumentException(SR.Argument_NoRegionInvariantCulture);
            }

            Contract.EndContractBlock();

            //
            // For CoreCLR we only want the region names that are full culture names
            //
            this.m_cultureData = CultureData.GetCultureDataForRegion(name, true);
            if (this.m_cultureData == null)
                throw new ArgumentException(
                    String.Format(
                        CultureInfo.CurrentCulture,
                        SR.Argument_InvalidCultureName, name), "name");


            // Not supposed to be neutral
            if (this.m_cultureData.IsNeutralCulture)
                throw new ArgumentException(SR.Format(SR.Argument_InvalidNeutralRegionName, name), "name");

            SetName(name);
        }
開發者ID:l1183479157,項目名稱:coreclr,代碼行數:30,代碼來源:RegionInfo.cs

示例5: TextInfo

 //////////////////////////////////////////////////////////////////////////
 ////
 ////  TextInfo Constructors
 ////
 ////  Implements CultureInfo.TextInfo.
 ////
 //////////////////////////////////////////////////////////////////////////
 internal unsafe TextInfo(CultureData cultureData)
 {
     // TODO: Implement this fully.
     this.m_cultureData = cultureData;
     this.m_cultureName = this.m_cultureData.CultureName;
     this.m_textInfoName = this.m_cultureData.STEXTINFO;
 }
開發者ID:enavro,項目名稱:coreclr,代碼行數:14,代碼來源:TextInfo.Unix.cs

示例6: TextInfo

 //////////////////////////////////////////////////////////////////////////
 ////
 ////  TextInfo Constructors
 ////
 ////  Implements CultureInfo.TextInfo.
 ////
 //////////////////////////////////////////////////////////////////////////
 internal unsafe TextInfo(CultureData cultureData)
 {
     m_cultureData = cultureData;
     m_cultureName = m_cultureData.CultureName;
     m_textInfoName = m_cultureData.STEXTINFO;
     m_needsTurkishCasing = NeedsTurkishCasing(m_textInfoName);
 }
開發者ID:Rayislandstyle,項目名稱:dotnet-coreclr,代碼行數:14,代碼來源:TextInfo.Unix.cs

示例7: TextInfo

 //////////////////////////////////////////////////////////////////////////
 ////
 ////  TextInfo Constructors
 ////
 ////  Implements CultureInfo.TextInfo.
 ////
 //////////////////////////////////////////////////////////////////////////
 internal unsafe TextInfo(CultureData cultureData)
 {
     // TODO: Implement this fully.
     m_cultureData = cultureData;
     m_cultureName = m_cultureData.CultureName;
     m_textInfoName = m_cultureData.STEXTINFO;
     m_needsTurkishCasing = NeedsTurkishCasing(this.m_textInfoName);
 }
開發者ID:perfectphase,項目名稱:coreclr,代碼行數:15,代碼來源:TextInfo.Unix.cs

示例8: TextInfo

 //////////////////////////////////////////////////////////////////////////
 ////
 ////  TextInfo Constructors
 ////
 ////  Implements CultureInfo.TextInfo.
 ////
 //////////////////////////////////////////////////////////////////////////
 internal unsafe TextInfo(CultureData cultureData)
 {
     // This is our primary data source, we don't need most of the rest of this
     this.m_cultureData = cultureData;
     this.m_cultureName = this.m_cultureData.CultureName;
     this.m_textInfoName = this.m_cultureData.STEXTINFO;
     FinishInitialization(this.m_textInfoName);
 }
開發者ID:dagood,項目名稱:coreclr,代碼行數:15,代碼來源:TextInfo.Windows.cs

示例9: TestThatCultureIsSavedAndReturned

        public void TestThatCultureIsSavedAndReturned()
        {
            var culture = new CultureData(CultureInfo.CurrentCulture);

            var entry = new LanguageEntry(culture);

            Assert.AreEqual(culture, entry.Language);
        }
開發者ID:hangy,項目名稱:openfoodfacts-category-web,代碼行數:8,代碼來源:LanguageEntryTests.cs

示例10: TextInfo

        //////////////////////////////////////////////////////////////////////////
        ////
        ////  TextInfo Constructors
        ////
        ////  Implements CultureInfo.TextInfo.
        ////
        //////////////////////////////////////////////////////////////////////////
        internal unsafe TextInfo(CultureData cultureData)
        {
            const uint LCMAP_SORTHANDLE = 0x20000000;

            // This is our primary data source, we don't need most of the rest of this
            _cultureData = cultureData;
            _cultureName = _cultureData.CultureName;
            _textInfoName = _cultureData.STEXTINFO;

            long handle;
            int ret = Interop.mincore.LCMapStringEx(_textInfoName, LCMAP_SORTHANDLE, null, 0, &handle, IntPtr.Size, null, null, IntPtr.Zero);
            _sortHandle = ret > 0 ? (IntPtr)handle : IntPtr.Zero;
        }
開發者ID:huamichaelchen,項目名稱:corert,代碼行數:20,代碼來源:TextInfo.Win32.cs

示例11: OnDeserialized

        private void OnDeserialized(StreamingContext ctx)
        {
            if (this.m_name != null)
            {
                m_cultureData = CultureData.GetCultureData(m_name, m_useUserOverride);
                // 
                if (this.m_cultureData == null)
                    throw new CultureNotFoundException(
                        "m_name", m_name, Environment.GetResourceString("Argument_CultureNotSupported"));
            }
            // Note: This is for Everett compatibility
            // 
#if FEATURE_USE_LCID
            else
                m_cultureData = CultureData.GetCultureData(CultureID, m_useUserOverride);
#endif
            if (calendar == null)
            {
                calendar = (Calendar) GregorianCalendar.GetDefaultInstance().Clone();
                calendar.SetReadOnlyState(m_isReadOnly);
            }
            else
            {
                CultureInfo.CheckDomainSafetyObject(calendar, this);
            }
            InitializeOverridableProperties(m_cultureData, calendar.ID);

            //
            //  turn off read only state till we finish initializing all fields and then store read only state after we are done.
            //
            bool isReadOnly = m_isReadOnly;
            m_isReadOnly = false;

            // If we deserialized defaults ala Whidbey, make sure they're still defaults
            // Whidbey's arrays could get a bit mixed up.
            if (longDatePattern  != null) this.LongDatePattern  = longDatePattern;
            if (shortDatePattern != null) this.ShortDatePattern = shortDatePattern;
            if (yearMonthPattern != null) this.YearMonthPattern = yearMonthPattern;
            if (longTimePattern  != null) this.LongTimePattern  = longTimePattern;
            if (shortTimePattern != null) this.ShortTimePattern = shortTimePattern;
            
            m_isReadOnly = isReadOnly;
        }
開發者ID:nlh774,項目名稱:DotNetReferenceSource,代碼行數:43,代碼來源:DateTimeFormatInfo.cs

示例12: nativeInitCultureData

 internal static extern bool nativeInitCultureData(CultureData cultureData);
開發者ID:JonHanna,項目名稱:coreclr,代碼行數:1,代碼來源:CultureData.cs

示例13: OnDeserialized

        private void OnDeserialized(StreamingContext ctx)
        {
#if FEATURE_CORECLR            
            // This won't happen anyway since CoreCLR doesn't support serialization
            this.m_cultureData = CultureData.GetCultureData(m_name, true);
#else
            if (m_name == null)
            {
                Contract.Assert(m_dataItem >= 0, "[RegionInfo.OnDeserialized] null name and invalid dataItem");
                m_cultureId = IdFromEverettRegionInfoDataItem[m_dataItem];
            }

            if (m_cultureId == 0)
            {
                this.m_cultureData = CultureData.GetCultureDataForRegion(this.m_name, true);
            }
            else
            {
                this.m_cultureData = CultureData.GetCultureData(m_cultureId, true);
            }
                
#endif
            if (this.m_cultureData == null)
                throw new ArgumentException(
                    String.Format(
                        CultureInfo.CurrentCulture,
                        Environment.GetResourceString("Argument_InvalidCultureName"), m_name), "m_name");

            if (m_cultureId == 0)
            {
                SetName(this.m_name);
            }
            else
            {
                this.m_name = this.m_cultureData.SREGIONNAME;
            }
        }
開發者ID:l1183479157,項目名稱:coreclr,代碼行數:37,代碼來源:RegionInfo.cs

示例14: CreateCultureData

        private static CultureData CreateCultureData(string cultureName, bool useUserOverride)
        {
            CultureData culture = new CultureData();
            culture._bUseOverrides = useUserOverride;
            culture._sRealName = cultureName;

            // Ask native code if that one's real
            if (culture.InitCultureData() == false)
            {
                if (culture.InitCompatibilityCultureData() == false)
                {
                    return null;
                }
            }

            return culture;
        }
開發者ID:kyulee1,項目名稱:corert,代碼行數:17,代碼來源:CultureData.cs

示例15: TextInfo

        ////////////////////////////////////////////////////////////////////////
        //
        //  TextInfo Constructors
        //
        //  Implements CultureInfo.TextInfo.
        //
        ////////////////////////////////////////////////////////////////////////
        internal TextInfo(CultureData cultureData) 
        {
            // This is our primary data source, we don't need most of the rest of this
            this.m_cultureData = cultureData;
            this.m_cultureName = this.m_cultureData.CultureName;
            this.m_textInfoName = this.m_cultureData.STEXTINFO;
#if !FEATURE_CORECLR
            IntPtr handleOrigin;
            this.m_dataHandle = CompareInfo.InternalInitSortHandle(m_textInfoName, out handleOrigin);
            this.m_handleOrigin = handleOrigin;
#endif
        }
開發者ID:gsfreema,項目名稱:coreclr,代碼行數:19,代碼來源:TextInfo.cs


注:本文中的System.Globalization.CultureData類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。