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
- ListViewDataItem.cs
- LocalizedNameDescriptionPair.cs
- AttributedMetaModel.cs
- LiteralSubsegment.cs
- PointHitTestResult.cs
- ScrollChrome.cs
- SpeakInfo.cs
- SetterBase.cs
- ChildTable.cs
- PageStatePersister.cs
- ScrollProperties.cs
- WebControlsSection.cs
- XmlChildEnumerator.cs
- NumericUpDownAccelerationCollection.cs
- Line.cs
- XmlAnyAttributeAttribute.cs
- ProcessInfo.cs
- IsolatedStorageException.cs
- SeverityFilter.cs
- Animatable.cs
- EntityDesignerUtils.cs
- FontFamily.cs
- DistributedTransactionPermission.cs
- KerberosSecurityTokenProvider.cs
- TableLayoutPanelCellPosition.cs
- Int32Animation.cs
- ConfigurationHandlersInstallComponent.cs
- ClientRolePrincipal.cs
- InternalCache.cs
- COM2ColorConverter.cs
- WindowsRichEdit.cs
- RequiredAttributeAttribute.cs
- StyleXamlParser.cs
- XmlSignificantWhitespace.cs
- MemberInitExpression.cs
- MsmqIntegrationInputChannel.cs
- SlipBehavior.cs
- XmlDataCollection.cs
- UnknownBitmapEncoder.cs
- Screen.cs
- XamlSerializerUtil.cs
- GregorianCalendar.cs
- AutomationElement.cs
- CheckPair.cs
- CompareValidator.cs
- invalidudtexception.cs
- SqlDataSourceStatusEventArgs.cs
- InternalCache.cs
- ListBoxItemWrapperAutomationPeer.cs
- SharedConnectionInfo.cs
- HybridDictionary.cs
- ScrollChrome.cs
- PopupRoot.cs
- RequestCachePolicy.cs
- Popup.cs
- Freezable.cs
- CompressionTransform.cs
- SchemaTypeEmitter.cs
- WebPartDisplayModeCancelEventArgs.cs
- IProvider.cs
- SelectionProviderWrapper.cs
- IPAddress.cs
- XmlTypeAttribute.cs
- XmlJsonReader.cs
- CodeBlockBuilder.cs
- TypeNameConverter.cs
- DataObjectFieldAttribute.cs
- DataControlFieldHeaderCell.cs
- ActivityExecutionContextCollection.cs
- RawStylusInputCustomDataList.cs
- StandardCommands.cs
- InvalidEnumArgumentException.cs
- XmlByteStreamReader.cs
- DataViewListener.cs
- PtsPage.cs
- JsonFormatWriterGenerator.cs
- SocketException.cs
- DescendantBaseQuery.cs
- WebRequestModuleElement.cs
- MaskedTextBox.cs
- StorageSetMapping.cs
- RecordConverter.cs
- MemberPath.cs
- ExceptionList.cs
- WeakReferenceKey.cs
- EntityKey.cs
- HtmlInputSubmit.cs
- SQLGuidStorage.cs
- PlatformNotSupportedException.cs
- XPathSelectionIterator.cs
- FormsAuthentication.cs
- FrameDimension.cs
- ListDictionary.cs
- GroupLabel.cs
- ObjectSet.cs
- TextRunTypographyProperties.cs
- CollectionViewGroup.cs
- TreeNodeEventArgs.cs
- DataGridBoundColumn.cs
- CodeNamespaceCollection.cs