System.Runtime.Serialization.SurrogateSelector.AddSurrogate C# (CSharp) Method

AddSurrogate() public method

public AddSurrogate ( System type, System context, System surrogate ) : void
type System
context System
surrogate System
return void
        public virtual void AddSurrogate(System.Type type, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.ISerializationSurrogate surrogate) { }
        public virtual void ChainSelector(System.Runtime.Serialization.ISurrogateSelector selector) { }

Usage Example

コード例 #1
0
        public BinaryMessageSerializer()
        {
            var surrogateSelector = new SurrogateSelector();
            surrogateSelector.AddSurrogate(typeof(XDocument), new StreamingContext(StreamingContextStates.All), new XContainerSurrogate());
            surrogateSelector.AddSurrogate(typeof(XElement), new StreamingContext(StreamingContextStates.All), new XElementSurrogate());

            binaryFormatter.SurrogateSelector = surrogateSelector;
        }
All Usage Examples Of System.Runtime.Serialization.SurrogateSelector::AddSurrogate