Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / Serialization / System / Text / SurrogateChar.cs / 1305376 / SurrogateChar.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Text { using System.Globalization; using System.Runtime.Serialization; // Just for SR struct SurrogateChar { char lowChar; char highChar; public const int MinValue = 0x10000; public const int MaxValue = MinValue + (1 << 20) - 1; const char surHighMin = (char) 0xd800; const char surHighMax = (char) 0xdbff; const char surLowMin = (char) 0xdc00; const char surLowMax = (char) 0xdfff; public SurrogateChar(int ch) { if (ch < MinValue || ch > MaxValue) throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.XmlInvalidSurrogate, ch.ToString("X", CultureInfo.InvariantCulture)), "ch")); const int mask = ((1 << 10) - 1); this.lowChar = (char) (((ch - MinValue) & mask) + surLowMin); this.highChar = (char) ((((ch - MinValue) >> 10) & mask) + surHighMin); } public SurrogateChar(char lowChar, char highChar) { if (lowChar < surLowMin || lowChar > surLowMax) throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.XmlInvalidLowSurrogate, ((int)lowChar).ToString("X", CultureInfo.InvariantCulture)), "lowChar")); if (highChar < surHighMin || highChar > surHighMax) throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.XmlInvalidHighSurrogate, ((int)highChar).ToString("X", CultureInfo.InvariantCulture)), "highChar")); this.lowChar = lowChar; this.highChar = highChar; } public char LowChar { get { return lowChar; } } public char HighChar { get { return highChar; } } public int Char { get { return (lowChar - surLowMin) | ((highChar - surHighMin) << 10) + MinValue; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- References.cs
- OdbcStatementHandle.cs
- CompensationTokenData.cs
- IntegrationExceptionEventArgs.cs
- ValidationRule.cs
- CompoundFileStorageReference.cs
- SqlTypeConverter.cs
- EntityContainerEmitter.cs
- _AutoWebProxyScriptHelper.cs
- ExceptionValidationRule.cs
- XsdCachingReader.cs
- AuthorizationSection.cs
- UniqueIdentifierService.cs
- Thread.cs
- StylusPointCollection.cs
- Item.cs
- RemoteCryptoDecryptRequest.cs
- InputReport.cs
- QilGenerator.cs
- EntityClassGenerator.cs
- MultiView.cs
- MimeMapping.cs
- StackBuilderSink.cs
- DocobjHost.cs
- EventMappingSettings.cs
- BamlVersionHeader.cs
- TextEffect.cs
- SqlCachedBuffer.cs
- LinqDataSourceSelectEventArgs.cs
- RtfToXamlReader.cs
- ChannelSinkStacks.cs
- Property.cs
- TypefaceMetricsCache.cs
- TraceListeners.cs
- PrincipalPermissionMode.cs
- SpecialFolderEnumConverter.cs
- _ScatterGatherBuffers.cs
- DbgCompiler.cs
- CodeGroup.cs
- TcpTransportElement.cs
- SqlTriggerAttribute.cs
- SearchForVirtualItemEventArgs.cs
- AssemblyResourceLoader.cs
- IsolatedStorageFileStream.cs
- InputScopeManager.cs
- RedistVersionInfo.cs
- SelectionHighlightInfo.cs
- SByteStorage.cs
- TableParagraph.cs
- ValueProviderWrapper.cs
- AlignmentXValidation.cs
- AutomationElementIdentifiers.cs
- RawStylusInputCustomDataList.cs
- TdsParserSessionPool.cs
- WebPartZoneAutoFormat.cs
- ItemCheckEvent.cs
- SQLDoubleStorage.cs
- MimeBasePart.cs
- FormViewDeletedEventArgs.cs
- ChangePassword.cs
- DataBindingList.cs
- ellipse.cs
- ItemContainerGenerator.cs
- SelectedCellsChangedEventArgs.cs
- MemberCollection.cs
- TaskHelper.cs
- SizeChangedInfo.cs
- SqlProfileProvider.cs
- XPathQueryGenerator.cs
- FormatSettings.cs
- FieldAccessException.cs
- CaseExpr.cs
- KeyboardNavigation.cs
- BufferedReadStream.cs
- ActivityExecutionContext.cs
- XmlEventCache.cs
- SqlFlattener.cs
- TransactionManager.cs
- ColorTransform.cs
- DesignerDataColumn.cs
- StreamAsIStream.cs
- ReturnValue.cs
- FigureHelper.cs
- PageThemeParser.cs
- HyperLink.cs
- SortedList.cs
- CrossSiteScriptingValidation.cs
- ParameterBuilder.cs
- DrawingCollection.cs
- HttpWebResponse.cs
- InputProcessorProfilesLoader.cs
- BitmapData.cs
- HttpResponseHeader.cs
- RoutingTable.cs
- ContainerParaClient.cs
- BitSet.cs
- StateMachineSubscriptionManager.cs
- SchemaMapping.cs
- _AutoWebProxyScriptWrapper.cs
- RelatedCurrencyManager.cs