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
- LinearKeyFrames.cs
- Composition.cs
- SchemaNames.cs
- PropertySegmentSerializationProvider.cs
- MinimizableAttributeTypeConverter.cs
- Stroke2.cs
- ExpressionConverter.cs
- _NativeSSPI.cs
- ListDataBindEventArgs.cs
- OleDbReferenceCollection.cs
- HtmlInputText.cs
- ComponentChangedEvent.cs
- TraceFilter.cs
- FileResponseElement.cs
- GenericEnumerator.cs
- StructuredCompositeActivityDesigner.cs
- ContentFileHelper.cs
- _NetRes.cs
- ToolboxSnapDragDropEventArgs.cs
- SharedPersonalizationStateInfo.cs
- BindingList.cs
- Permission.cs
- AssemblySettingAttributes.cs
- TemplateXamlParser.cs
- XsdBuildProvider.cs
- ToolBarButton.cs
- CngKeyBlobFormat.cs
- XmlLangPropertyAttribute.cs
- Symbol.cs
- ImageButton.cs
- BamlWriter.cs
- ReceiveReply.cs
- CompressStream.cs
- BinaryQueryOperator.cs
- JournalNavigationScope.cs
- WebPartRestoreVerb.cs
- AppSettingsExpressionBuilder.cs
- WindowsGraphicsCacheManager.cs
- XslCompiledTransform.cs
- LongTypeConverter.cs
- PixelFormatConverter.cs
- SettingsSavedEventArgs.cs
- LabelLiteral.cs
- DetailsViewPagerRow.cs
- MessageSmuggler.cs
- SplitterCancelEvent.cs
- Helper.cs
- QilNode.cs
- AutomationEvent.cs
- _ListenerAsyncResult.cs
- Line.cs
- RulePatternOps.cs
- ColorConverter.cs
- EntityTemplateUserControl.cs
- ConnectionDemuxer.cs
- UdpMessageProperty.cs
- TiffBitmapEncoder.cs
- RequestCachePolicy.cs
- IndentedWriter.cs
- GridItemProviderWrapper.cs
- SlipBehavior.cs
- TreeViewDesigner.cs
- DesignSurfaceServiceContainer.cs
- ManifestResourceInfo.cs
- HandlerBase.cs
- BindToObject.cs
- UIServiceHelper.cs
- GroupQuery.cs
- HttpListenerPrefixCollection.cs
- XPathAxisIterator.cs
- GeneralTransformGroup.cs
- NamedPipeHostedTransportConfiguration.cs
- Semaphore.cs
- Int64AnimationBase.cs
- ControlType.cs
- CssStyleCollection.cs
- Annotation.cs
- TypeValidationEventArgs.cs
- FreezableOperations.cs
- BasicHttpSecurityMode.cs
- SqlFormatter.cs
- RadioButtonRenderer.cs
- DesignerSerializationManager.cs
- CodeTypeMember.cs
- Frame.cs
- SynchronousSendBindingElement.cs
- XamlTreeBuilder.cs
- EndpointPerformanceCounters.cs
- ImageFormatConverter.cs
- StateWorkerRequest.cs
- Triangle.cs
- NotConverter.cs
- QilSortKey.cs
- _SslState.cs
- Stylesheet.cs
- TextFindEngine.cs
- RenderingEventArgs.cs
- LineBreakRecord.cs
- GlobalizationAssembly.cs
- DataBindingCollection.cs