Code:
/ 4.0 / 4.0 / 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. //------------------------------------------------------------------------------ // 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
- NullableBoolConverter.cs
- EncodingInfo.cs
- TextViewSelectionProcessor.cs
- SiteMapSection.cs
- XmlSchemaElement.cs
- InstanceCollisionException.cs
- PageCatalogPart.cs
- FunctionDetailsReader.cs
- cache.cs
- DesignerAttribute.cs
- ObjectRef.cs
- DocumentPage.cs
- AuthorizationSection.cs
- MultiDataTrigger.cs
- LinqDataSource.cs
- EasingQuaternionKeyFrame.cs
- InheritanceAttribute.cs
- ClientTargetCollection.cs
- DataListItemEventArgs.cs
- SystemResourceHost.cs
- DataServiceRequestOfT.cs
- FixedSOMPageElement.cs
- CompilerResults.cs
- XPathNavigator.cs
- HierarchicalDataBoundControlAdapter.cs
- ErrorWebPart.cs
- BufferBuilder.cs
- RSAPKCS1SignatureDeformatter.cs
- ConstantCheck.cs
- AccessibleObject.cs
- Misc.cs
- SqlDataSourceCustomCommandEditor.cs
- AmbientLight.cs
- SerializableTypeCodeDomSerializer.cs
- ContextProperty.cs
- TransformCryptoHandle.cs
- NavigatingCancelEventArgs.cs
- MultilineStringEditor.cs
- HMACSHA384.cs
- PrintingPermission.cs
- MdiWindowListStrip.cs
- CatalogPartChrome.cs
- XamlSerializerUtil.cs
- ServiceOperationParameter.cs
- DataGridBoolColumn.cs
- TreeNodeEventArgs.cs
- ObjectContext.cs
- WebRequestModulesSection.cs
- RepeatButtonAutomationPeer.cs
- RuntimeConfig.cs
- TargetConverter.cs
- CachingParameterInspector.cs
- ContainerParagraph.cs
- ButtonChrome.cs
- TypeUnloadedException.cs
- JoinCqlBlock.cs
- Latin1Encoding.cs
- CanonicalFormWriter.cs
- basenumberconverter.cs
- ElementAction.cs
- ListParagraph.cs
- DataGridViewColumnCollection.cs
- X509CertificateTrustedIssuerElement.cs
- AsymmetricKeyExchangeFormatter.cs
- RectangleHotSpot.cs
- ToolStripSystemRenderer.cs
- HttpServerVarsCollection.cs
- CmsUtils.cs
- HostingEnvironmentException.cs
- Renderer.cs
- SpellerError.cs
- HtmlButton.cs
- LogStore.cs
- DynamicILGenerator.cs
- SHA384.cs
- TableAutomationPeer.cs
- NameSpaceExtractor.cs
- ListViewItemMouseHoverEvent.cs
- CopyAction.cs
- Control.cs
- securestring.cs
- ListViewContainer.cs
- PrivateFontCollection.cs
- StorageTypeMapping.cs
- SqlBuffer.cs
- ToolZone.cs
- BinaryUtilClasses.cs
- XsltException.cs
- BoundsDrawingContextWalker.cs
- PrePrepareMethodAttribute.cs
- GetWinFXPath.cs
- MappingSource.cs
- XamlTypeMapper.cs
- DataDocumentXPathNavigator.cs
- Faults.cs
- listitem.cs
- XPathParser.cs
- _FixedSizeReader.cs
- Vector3DKeyFrameCollection.cs
- DrawingImage.cs