本文整理汇总了C#中ISurrogateSelector.ChainSelector方法的典型用法代码示例。如果您正苦于以下问题:C# ISurrogateSelector.ChainSelector方法的具体用法?C# ISurrogateSelector.ChainSelector怎么用?C# ISurrogateSelector.ChainSelector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISurrogateSelector
的用法示例。
在下文中一共展示了ISurrogateSelector.ChainSelector方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChainSelector
/// <summary>
/// Adds the specified <see cref="T:System.Runtime.Serialization.ISurrogateSelector"/> that
/// can handle a particular object type to the list of surrogates.
/// </summary>
/// <param name="selector">The surrogate selector to add.</param>
/// <exception cref="T:System.ArgumentNullException">The
/// <paramref name="selector"/>parameter is null.</exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The selector is
/// already on the list of selectors.</exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the
/// required permission.</exception>
public virtual void ChainSelector(ISurrogateSelector selector) {
if (selector == null)
throw new ArgumentNullException("Selector is null.");
if (_nextSelector != null)
selector.ChainSelector(_nextSelector);
_nextSelector = selector;
}
示例2: ChainSelector
public virtual void ChainSelector(ISurrogateSelector selector)
{
if (selector == null)
{
throw new ArgumentNullException("Selector is null.");
}
if (this._nextSelector != null)
{
selector.ChainSelector(this._nextSelector);
}
this._nextSelector = selector;
}
示例3: ChainSelector
public virtual void ChainSelector (ISurrogateSelector selector)
{
if (selector == null)
throw new ArgumentNullException ("Selector is null.");
// Chain the selector at the beggining of the chain
// since "The last selector added to the list will be the first one checked"
// (from MS docs)
if (nextSelector != null)
selector.ChainSelector (nextSelector);
nextSelector = selector;
}
示例4: ChainSelector
public virtual void ChainSelector (ISurrogateSelector selector)
{
if (_next != null) selector.ChainSelector (_next);
_next = selector;
}
示例5: ChainSelector
[System.Security.SecurityCritical] // auto-generated_required
public virtual void ChainSelector(ISurrogateSelector selector) {
ISurrogateSelector temp;
ISurrogateSelector tempCurr;
ISurrogateSelector tempPrev;
ISurrogateSelector tempEnd;
if (selector==null) {
throw new ArgumentNullException("selector");
}
Contract.EndContractBlock();
//
// Verify that we don't try and add ourself twice.
//
if (selector==this) {
throw new SerializationException(Environment.GetResourceString("Serialization_DuplicateSelector"));
}
//
// Verify that the argument doesn't contain a cycle.
//
if (!HasCycle(selector)) {
throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycleInArgument"), "selector");
}
//
// Check for a cycle that would lead back to this. We find the end of the list that we're being asked to
// insert for use later.
//
tempCurr = selector.GetNextSelector();
tempEnd = selector;
while (tempCurr!=null && tempCurr!=this) {
tempEnd = tempCurr;
tempCurr = tempCurr.GetNextSelector();
}
if (tempCurr==this) {
throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycle"), "selector");
}
//
// Check for a cycle later in the list which would be introduced by this insertion.
//
tempCurr = selector;
tempPrev = selector;
while(tempCurr!=null) {
if (tempCurr==tempEnd) {
tempCurr = this.GetNextSelector();
} else {
tempCurr = tempCurr.GetNextSelector();
}
if (tempCurr==null) {
break;
}
if (tempCurr==tempPrev) {
throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycle"), "selector");
}
if (tempCurr==tempEnd) {
tempCurr = this.GetNextSelector();
} else {
tempCurr = tempCurr.GetNextSelector();
}
if (tempPrev==tempEnd) {
tempPrev = this.GetNextSelector();
} else {
tempPrev = tempPrev.GetNextSelector();
}
if (tempCurr==tempPrev) {
throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycle"), "selector");
}
}
//
// Add the new selector and it's entire chain of selectors as the next thing that
// we check.
//
temp = m_nextSelector;
m_nextSelector = selector;
if (temp!=null) {
tempEnd.ChainSelector(temp);
}
}