• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Globalization.CultureData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Globalization.CultureData的典型用法代码示例。如果您正苦于以下问题:C# CultureData类的具体用法?C# CultureData怎么用?C# CultureData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CultureData类属于System.Globalization命名空间,在下文中一共展示了CultureData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: InitializeFromCultureId

        private void InitializeFromCultureId(int culture, bool useUserOverride)
        {
            switch (culture)
            {
                case LOCALE_CUSTOM_DEFAULT:
                case LOCALE_SYSTEM_DEFAULT:
                case LOCALE_NEUTRAL:
                case LOCALE_USER_DEFAULT:
                case LOCALE_CUSTOM_UNSPECIFIED:
                    // Can't support unknown custom cultures and we do not support neutral or
                    // non-custom user locales.
                    throw new CultureNotFoundException("culture", culture, SR.Argument_CultureNotSupported);

                default:
                    // Now see if this LCID is supported in the system default CultureData table.
                    m_cultureData = CultureData.GetCultureData(culture, useUserOverride);
                    break;
            }
            m_isInherited = (this.GetType() != typeof(System.Globalization.CultureInfo));
            m_name = m_cultureData.CultureName;
        }
开发者ID:nietras,项目名称:coreclr,代码行数:21,代码来源:CultureInfo.cs


示例17: CultureInfo

        // Constructor called by SQL Server's special munged culture - creates a culture with
        // a TextInfo and CompareInfo that come from a supplied alternate source. This object
        // is ALWAYS read-only.
        // Note that we really cannot use an LCID version of this override as the cached
        // name we create for it has to include both names, and the logic for this is in
        // the GetCultureInfo override *only*.
        internal CultureInfo(String cultureName, String textAndCompareCultureName)
        {
            if (cultureName == null)
            {
                throw new ArgumentNullException("cultureName",SR.ArgumentNull_String);
            }
            Contract.EndContractBlock();

            m_cultureData = CultureData.GetCultureData(cultureName, false);
            if (m_cultureData == null)
                throw new CultureNotFoundException("cultureName", cultureName, SR.Argument_CultureNotSupported);
            
            m_name = m_cultureData.CultureName;

            CultureInfo altCulture = GetCultureInfo(textAndCompareCultureName);
            compareInfo = altCulture.CompareInfo;
            textInfo = altCulture.TextInfo;
        }
开发者ID:nietras,项目名称:coreclr,代码行数:24,代码来源:CultureInfo.cs


示例18: CultureInfo

		private CultureInfo (string name, bool useUserOverride, bool read_only)
		{
			if (name == null)
				throw new ArgumentNullException ("name");

			constructed = true;
			m_isReadOnly = read_only;
			m_useUserOverride = useUserOverride;
			m_isInherited = GetType() != typeof(System.Globalization.CultureInfo);

			if (name.Length == 0) {
				/* Short circuit the invariant culture */
				m_cultureData = CultureData.Invariant;
				ConstructInvariant (read_only);
				return;
			}

			if (!construct_internal_locale_from_name (name.ToLowerInvariant ())) {
				throw CreateNotFoundException (name);
			}

			var ti = GetTextInfoData ();
			m_cultureData = CultureData.GetCultureData (m_name, useUserOverride, datetime_index, CalendarType, number_index, iso2lang,
				ti.ansi, ti.oem, ti.mac, ti.ebcdic, ti.right_to_left, ((char)ti.list_sep).ToString ());
		}
开发者ID:razzfazz,项目名称:mono,代码行数:25,代码来源:CultureInfo.cs


示例19: TextInfo

 //////////////////////////////////////////////////////////////////////////
 ////
 ////  TextInfo Constructors
 ////
 ////  Implements CultureInfo.TextInfo.
 ////
 //////////////////////////////////////////////////////////////////////////
 internal unsafe TextInfo(CultureData cultureData)
 {
     // TODO: Implement this fully.
 }
开发者ID:afrog33k,项目名称:csnative,代码行数:11,代码来源:TextInfo.Unix.cs


示例20: CultureInfo

		private CultureInfo (int culture, bool useUserOverride, bool read_only)
		{
			if (culture < 0)
				throw new ArgumentOutOfRangeException ("culture", "Positive "
					+ "number required.");

			constructed = true;
			m_isReadOnly = read_only;
			m_useUserOverride = useUserOverride;

			if (culture == InvariantCultureId) {
				/* Short circuit the invariant culture */
				ConstructInvariant (read_only);
				m_cultureData = CultureData.Invariant;
				return;
			}

			if (!construct_internal_locale_from_lcid (culture)) {
				//
				// Be careful not to cause recursive CultureInfo initialization
				//
				var msg = string.Format (InvariantCulture, "Culture ID {0} (0x{1}) is not a supported culture.", culture.ToString (InvariantCulture), culture.ToString ("X4", InvariantCulture));
				throw new CultureNotFoundException ("culture", msg);
			}

			m_cultureData = CultureData.GetCultureData (m_name, m_useUserOverride, datetime_index, CalendarType, iso2lang);
		}
开发者ID:shana,项目名称:mono,代码行数:27,代码来源:CultureInfo.cs



注:本文中的System.Globalization.CultureData类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Globalization.CultureInfo类代码示例发布时间:2022-05-26
下一篇:
C# Globalization.CompareInfo类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap