本文整理汇总了C#中ISurrogateSelector.GetNextSelector方法的典型用法代码示例。如果您正苦于以下问题:C# ISurrogateSelector.GetNextSelector方法的具体用法?C# ISurrogateSelector.GetNextSelector怎么用?C# ISurrogateSelector.GetNextSelector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISurrogateSelector
的用法示例。
在下文中一共展示了ISurrogateSelector.GetNextSelector方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HasCycle
[System.Security.SecurityCritical] // auto-generated
private static bool HasCycle(ISurrogateSelector selector) {
ISurrogateSelector head;
ISurrogateSelector tail;
Contract.Assert(selector!=null, "[HasCycle]selector!=null");
head = selector;
tail = selector;
while (head!=null) {
head = head.GetNextSelector();
if (head==null) {
return true;
}
if (head==tail) {
return false;
}
head = head.GetNextSelector();
tail = tail.GetNextSelector();
if (head==tail) {
return false;
}
}
return true;
}
示例2: IsInList
// Determine if a selector is in a list of selectors.
private static bool IsInList(ISurrogateSelector selector,
ISurrogateSelector list)
{
while(list != null)
{
if(list == selector)
{
return true;
}
list = list.GetNextSelector();
}
return false;
}
示例3: 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);
}
}
示例4: ChainSelector
// Adds another selector to check if we don't have match within this selector.
// The logic is:"Add this onto the list as the first thing that you check after yourself."
public virtual void ChainSelector(ISurrogateSelector selector)
{
if (selector == null)
{
throw new ArgumentNullException(nameof(selector));
}
// Verify that we don't try and add ourself twice.
if (selector == this)
{
throw new SerializationException(SR.Serialization_DuplicateSelector);
}
// Verify that the argument doesn't contain a cycle.
if (!HasCycle(selector))
{
throw new ArgumentException(SR.Serialization_SurrogateCycleInArgument, nameof(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.
ISurrogateSelector tempCurr = selector.GetNextSelector();
ISurrogateSelector tempEnd = selector;
while (tempCurr != null && tempCurr != this)
{
tempEnd = tempCurr;
tempCurr = tempCurr.GetNextSelector();
}
if (tempCurr == this)
{
throw new ArgumentException(SR.Serialization_SurrogateCycle, nameof(selector));
}
// Check for a cycle later in the list which would be introduced by this insertion.
tempCurr = selector;
ISurrogateSelector tempPrev = selector;
while (tempCurr != null)
{
if (tempCurr == tempEnd)
{
tempCurr = GetNextSelector();
}
else
{
tempCurr = tempCurr.GetNextSelector();
}
if (tempCurr == null)
{
break;
}
if (tempCurr == tempPrev)
{
throw new ArgumentException(SR.Serialization_SurrogateCycle, nameof(selector));
}
if (tempCurr == tempEnd)
{
tempCurr = GetNextSelector();
}
else
{
tempCurr = tempCurr.GetNextSelector();
}
if (tempPrev == tempEnd)
{
tempPrev = GetNextSelector();
}
else
{
tempPrev = tempPrev.GetNextSelector();
}
if (tempCurr == tempPrev)
{
throw new ArgumentException(SR.Serialization_SurrogateCycle, nameof(selector));
}
}
// Add the new selector and it's entire chain of selectors as the next thing that we check.
ISurrogateSelector temp = _nextSelector;
_nextSelector = selector;
if (temp != null)
{
tempEnd.ChainSelector(temp);
}
}
示例5: ChainSelector
public virtual void ChainSelector(ISurrogateSelector selector)
{
if (selector == null)
{
throw new ArgumentNullException("selector");
}
if (selector == this)
{
throw new SerializationException(Environment.GetResourceString("Serialization_DuplicateSelector"));
}
if (!HasCycle(selector))
{
throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycleInArgument"), "selector");
}
ISurrogateSelector nextSelector = selector.GetNextSelector();
ISurrogateSelector selector5 = selector;
while ((nextSelector != null) && (nextSelector != this))
{
selector5 = nextSelector;
nextSelector = nextSelector.GetNextSelector();
}
if (nextSelector == this)
{
throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycle"), "selector");
}
nextSelector = selector;
ISurrogateSelector selector4 = selector;
while (nextSelector != null)
{
if (nextSelector == selector5)
{
nextSelector = this.GetNextSelector();
}
else
{
nextSelector = nextSelector.GetNextSelector();
}
if (nextSelector == null)
{
break;
}
if (nextSelector == selector4)
{
throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycle"), "selector");
}
if (nextSelector == selector5)
{
nextSelector = this.GetNextSelector();
}
else
{
nextSelector = nextSelector.GetNextSelector();
}
if (selector4 == selector5)
{
selector4 = this.GetNextSelector();
}
else
{
selector4 = selector4.GetNextSelector();
}
if (nextSelector == selector4)
{
throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycle"), "selector");
}
}
ISurrogateSelector selector2 = this.m_nextSelector;
this.m_nextSelector = selector;
if (selector2 != null)
{
selector5.ChainSelector(selector2);
}
}