Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / Serialization / System / Text / SurrogateChar.cs / 1 / 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. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ADConnectionHelper.cs
- Decimal.cs
- ObjectSpanRewriter.cs
- Timeline.cs
- EditingScope.cs
- UseAttributeSetsAction.cs
- mansign.cs
- OpCodes.cs
- Dictionary.cs
- SQLBoolean.cs
- CurrentChangedEventManager.cs
- DataRowChangeEvent.cs
- RawMouseInputReport.cs
- NetworkStream.cs
- MsmqHostedTransportConfiguration.cs
- ExpressionConverter.cs
- TiffBitmapEncoder.cs
- FixedLineResult.cs
- Journal.cs
- InternalBufferOverflowException.cs
- Rect3D.cs
- NameSpaceExtractor.cs
- DesignBinding.cs
- DataSourceControl.cs
- Matrix3DValueSerializer.cs
- SqlServer2KCompatibilityAnnotation.cs
- ListBoxItem.cs
- SqlBuilder.cs
- WindowAutomationPeer.cs
- ArgumentOutOfRangeException.cs
- DataShape.cs
- SoapParser.cs
- XmlDesigner.cs
- IndexerNameAttribute.cs
- StreamWithDictionary.cs
- ISSmlParser.cs
- RegistrationProxy.cs
- Themes.cs
- PassportPrincipal.cs
- DataGridViewCellEventArgs.cs
- DefaultAsyncDataDispatcher.cs
- Binding.cs
- XmlUrlResolver.cs
- XmlSerializerNamespaces.cs
- FrameworkElementFactory.cs
- ToolStripRenderEventArgs.cs
- TypedDataSetSchemaImporterExtension.cs
- AmbientValueAttribute.cs
- StylusShape.cs
- PreservationFileReader.cs
- InvalidDataContractException.cs
- PowerModeChangedEventArgs.cs
- EditorZoneAutoFormat.cs
- NetStream.cs
- OrderedParallelQuery.cs
- IERequestCache.cs
- odbcmetadatacollectionnames.cs
- MLangCodePageEncoding.cs
- Converter.cs
- IIS7UserPrincipal.cs
- URL.cs
- UncommonField.cs
- ListViewItem.cs
- SrgsDocumentParser.cs
- AlphabeticalEnumConverter.cs
- PaperSize.cs
- PartitionResolver.cs
- SqlParameter.cs
- Item.cs
- ProfessionalColors.cs
- ImageMetadata.cs
- TokenBasedSet.cs
- NullExtension.cs
- TextRangeEditTables.cs
- UnknownBitmapEncoder.cs
- Roles.cs
- XmlDocumentViewSchema.cs
- XmlSchemaValidator.cs
- EFColumnProvider.cs
- ExecutedRoutedEventArgs.cs
- BitmapEffectDrawing.cs
- ListControlConvertEventArgs.cs
- Vector.cs
- DBConnection.cs
- TextEditorDragDrop.cs
- HttpProcessUtility.cs
- WebPart.cs
- CopyCodeAction.cs
- ManagementOptions.cs
- DataContractSet.cs
- VisualTreeHelper.cs
- DataGridBoolColumn.cs
- OuterGlowBitmapEffect.cs
- Soap12ServerProtocol.cs
- DispatchChannelSink.cs
- BevelBitmapEffect.cs
- WindowsServiceCredential.cs
- ThreadPool.cs
- TextRange.cs
- Span.cs