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
- InvalidateEvent.cs
- SessionState.cs
- UnsafeNativeMethodsCLR.cs
- RegexWriter.cs
- CompilationLock.cs
- PlainXmlDeserializer.cs
- ChangesetResponse.cs
- PresentationUIStyleResources.cs
- SecurityUniqueId.cs
- IsolatedStorageFile.cs
- HtmlInputReset.cs
- LockedAssemblyCache.cs
- ExponentialEase.cs
- MemberDomainMap.cs
- CounterCreationDataCollection.cs
- SqlConnectionFactory.cs
- HeaderedContentControl.cs
- OLEDB_Enum.cs
- FormViewPagerRow.cs
- ManagementPath.cs
- SqlAliaser.cs
- DecoderExceptionFallback.cs
- XmlSchemaElement.cs
- TextElementCollection.cs
- ListBoxItem.cs
- GridLength.cs
- InProcStateClientManager.cs
- Listbox.cs
- UserControlBuildProvider.cs
- ObjectQuery.cs
- ConstraintConverter.cs
- AuthenticatedStream.cs
- FormViewUpdatedEventArgs.cs
- TypeInitializationException.cs
- Lasso.cs
- EmptyReadOnlyDictionaryInternal.cs
- AppDomainManager.cs
- TreeNodeStyle.cs
- SymmetricAlgorithm.cs
- AsyncResult.cs
- ContentType.cs
- GetUserPreferenceRequest.cs
- WinEventTracker.cs
- MetadataCollection.cs
- XmlSerializerFactory.cs
- UniqueID.cs
- MessageEnumerator.cs
- MexNamedPipeBindingElement.cs
- ExpressionBinding.cs
- httpapplicationstate.cs
- AdornedElementPlaceholder.cs
- RawTextInputReport.cs
- MonthCalendarDesigner.cs
- ConvertBinder.cs
- EventMetadata.cs
- ColorInterpolationModeValidation.cs
- TrackBarRenderer.cs
- Assembly.cs
- Baml2006ReaderContext.cs
- Decoder.cs
- RegionIterator.cs
- ItemCheckedEvent.cs
- LinqDataSourceInsertEventArgs.cs
- BitmapEffectCollection.cs
- MimeMapping.cs
- LogicalExpr.cs
- ImageBrush.cs
- ToolStripDropTargetManager.cs
- TableHeaderCell.cs
- LassoHelper.cs
- DataObjectEventArgs.cs
- GridViewRowPresenterBase.cs
- AsyncPostBackTrigger.cs
- BrowsableAttribute.cs
- NetNamedPipeBindingElement.cs
- EntityStoreSchemaGenerator.cs
- TrustSection.cs
- DataGridViewRowsRemovedEventArgs.cs
- AdornerDecorator.cs
- ApplicationDirectory.cs
- EndOfStreamException.cs
- HtmlShimManager.cs
- TcpTransportSecurityElement.cs
- EntityCollectionChangedParams.cs
- _CookieModule.cs
- PropertyToken.cs
- CodePageUtils.cs
- BreakRecordTable.cs
- ToolStripComboBox.cs
- DataGridViewRowConverter.cs
- StorageSetMapping.cs
- ellipse.cs
- HttpFileCollection.cs
- ItemList.cs
- FlowPosition.cs
- TreeNodeConverter.cs
- _DomainName.cs
- RenderData.cs
- RTLAwareMessageBox.cs
- WebPageTraceListener.cs