本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例9: TestThatCultureIsSavedAndReturned
public void TestThatCultureIsSavedAndReturned()
{
var culture = new CultureData(CultureInfo.CurrentCulture);
var entry = new LanguageEntry(culture);
Assert.AreEqual(culture, entry.Language);
}
示例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;
}
示例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;
}
示例12: nativeInitCultureData
internal static extern bool nativeInitCultureData(CultureData cultureData);
示例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;
}
}
示例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;
}
示例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
}