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
- Base64Stream.cs
- BinaryFormatter.cs
- TextBoxLine.cs
- IIS7WorkerRequest.cs
- Empty.cs
- IBuiltInEvidence.cs
- XmlSerializerOperationGenerator.cs
- WindowsTitleBar.cs
- SevenBitStream.cs
- ResizingMessageFilter.cs
- SqlUnionizer.cs
- InstanceDescriptor.cs
- InternalConfigSettingsFactory.cs
- Encoding.cs
- VerificationAttribute.cs
- JsonCollectionDataContract.cs
- HttpApplication.cs
- DecimalFormatter.cs
- AssemblyAttributesGoHere.cs
- CodeSnippetStatement.cs
- TypedTableHandler.cs
- XmlHierarchyData.cs
- DrawingContextDrawingContextWalker.cs
- Debug.cs
- SoapAttributes.cs
- NumericUpDownAcceleration.cs
- WorkflowFormatterBehavior.cs
- RefreshEventArgs.cs
- GPRECT.cs
- ProcessHost.cs
- SoapCodeExporter.cs
- SafeNativeMethods.cs
- PropertyGroupDescription.cs
- DataContractJsonSerializer.cs
- AstTree.cs
- NestPullup.cs
- ConstrainedGroup.cs
- XsdCachingReader.cs
- XmlSortKeyAccumulator.cs
- TrustLevel.cs
- MasterPage.cs
- ListViewHitTestInfo.cs
- ObjectQuery.cs
- PlanCompilerUtil.cs
- XmlSchemaElement.cs
- DefaultProfileManager.cs
- CollectionView.cs
- SchemaMapping.cs
- VScrollBar.cs
- DoubleMinMaxAggregationOperator.cs
- CodeConstructor.cs
- documentsequencetextview.cs
- Span.cs
- TableProviderWrapper.cs
- BrowserCapabilitiesCompiler.cs
- TimeSpan.cs
- DeviceContext2.cs
- ItemCollection.cs
- Stream.cs
- GridViewEditEventArgs.cs
- HostVisual.cs
- Page.cs
- ToolStripItemTextRenderEventArgs.cs
- ToolStripProgressBar.cs
- ProfileSettingsCollection.cs
- TitleStyle.cs
- Stylus.cs
- Security.cs
- DiscoveryClientChannelBase.cs
- ExtenderHelpers.cs
- SmiGettersStream.cs
- SEHException.cs
- FixedSOMTable.cs
- DesignerAttribute.cs
- ListItemCollection.cs
- AutoResizedEvent.cs
- StringSource.cs
- VectorValueSerializer.cs
- MessageSecurityException.cs
- DataPagerFieldCollection.cs
- WsdlHelpGeneratorElement.cs
- CategoryGridEntry.cs
- ResXResourceReader.cs
- QilBinary.cs
- DesignerImageAdapter.cs
- SequenceDesigner.cs
- SaveFileDialog.cs
- SymDocumentType.cs
- CompositeActivityTypeDescriptorProvider.cs
- _AuthenticationState.cs
- Configuration.cs
- DirectionalLight.cs
- DataRecordObjectView.cs
- OutputCacheSection.cs
- ThreadSafeList.cs
- MembershipUser.cs
- SemanticAnalyzer.cs
- NativeMethods.cs
- PostBackOptions.cs
- _DisconnectOverlappedAsyncResult.cs