Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Common / AuthoringOM / Serializer / SimpleTypesSurrogate.cs / 1305376 / SimpleTypesSurrogate.cs
namespace System.Workflow.ComponentModel.Serialization { using System; using System.Xml; using System.Runtime.Serialization; using System.Reflection; using System.IO; using System.Runtime.Serialization.Formatters.Binary; using System.Collections; using System.Collections.Generic; #region SimpleTypesSurrogate //This class is currently used only for Guids. The size diff is 93 bytes per guid over binary formatter //Will add support for other types as well, eventually. internal sealed class SimpleTypesSurrogate : ISerializationSurrogate { enum TypeID : byte { Guid = 1, Null, } void ISerializationSurrogate.GetObjectData(object obj, SerializationInfo info, StreamingContext context) { if (obj.GetType() == typeof(Guid)) { Guid guid = (Guid)obj; info.AddValue("typeID", TypeID.Guid); info.AddValue("bits", guid.ToByteArray()); } } object ISerializationSurrogate.SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector) { TypeID typeID = (TypeID)info.GetValue("typeID", typeof(TypeID)); if (typeID == TypeID.Guid) return new Guid(info.GetValue("bits", typeof(byte[])) as byte[]); return null; } } #endregion } // 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
- HandlerBase.cs
- PropertyTab.cs
- CodeTypeReference.cs
- SortKey.cs
- ObjectTokenCategory.cs
- SymbolUsageManager.cs
- OleDbRowUpdatedEvent.cs
- GeneralTransform.cs
- COAUTHIDENTITY.cs
- ShaderRenderModeValidation.cs
- ProfileGroupSettings.cs
- WsatServiceCertificate.cs
- NavigationProperty.cs
- RTLAwareMessageBox.cs
- EastAsianLunisolarCalendar.cs
- InputReferenceExpression.cs
- SqlDataSourceDesigner.cs
- IsolatedStorageFilePermission.cs
- SkewTransform.cs
- StandardToolWindows.cs
- WebSysDisplayNameAttribute.cs
- FormViewUpdateEventArgs.cs
- AppSecurityManager.cs
- RelationshipEntry.cs
- XmlSchemaType.cs
- HistoryEventArgs.cs
- BitmapEffectInputData.cs
- DispatcherOperation.cs
- StringSource.cs
- ResourceBinder.cs
- Random.cs
- NumberFunctions.cs
- XhtmlBasicControlAdapter.cs
- DbModificationCommandTree.cs
- RoleGroupCollection.cs
- ServiceSettingsResponseInfo.cs
- Polyline.cs
- IdentitySection.cs
- HttpModuleCollection.cs
- DetailsViewInsertedEventArgs.cs
- Icon.cs
- WinFormsSpinner.cs
- ResourceContainer.cs
- CompiledAction.cs
- ListenUriMode.cs
- OLEDB_Enum.cs
- ThreadStartException.cs
- _CommandStream.cs
- ObjectDataSource.cs
- LocatorBase.cs
- CodeBinaryOperatorExpression.cs
- Size3D.cs
- EntityCommandCompilationException.cs
- ConfigurationManagerInternalFactory.cs
- EditorPartChrome.cs
- HtmlInputRadioButton.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- HyperLink.cs
- Pool.cs
- NumberFormatter.cs
- nulltextcontainer.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- InputLanguageProfileNotifySink.cs
- SafeRegistryHandle.cs
- PolyBezierSegmentFigureLogic.cs
- HttpApplicationFactory.cs
- FormatterConverter.cs
- AttachedPropertyDescriptor.cs
- DataGridViewIntLinkedList.cs
- HTMLTextWriter.cs
- TextServicesCompartment.cs
- SimpleRecyclingCache.cs
- HttpResponseHeader.cs
- FacetValues.cs
- XD.cs
- SHA512Managed.cs
- CalendarTable.cs
- CrossSiteScriptingValidation.cs
- InfiniteTimeSpanConverter.cs
- DataPagerFieldCommandEventArgs.cs
- CodeTypeDelegate.cs
- IImplicitResourceProvider.cs
- DataGridColumnHeadersPresenter.cs
- XMLUtil.cs
- TrustLevelCollection.cs
- OrthographicCamera.cs
- XmlBinaryWriterSession.cs
- TagPrefixInfo.cs
- DropAnimation.xaml.cs
- MissingSatelliteAssemblyException.cs
- StylusEventArgs.cs
- LogStore.cs
- PeerNearMe.cs
- BinaryCommonClasses.cs
- CodeDomDesignerLoader.cs
- OleDbFactory.cs
- NameValuePermission.cs
- SqlDataSourceFilteringEventArgs.cs
- ProxyHwnd.cs
- ToolBar.cs