/// <summary> /// Mark this type reachable. /// </summary> public void SetReachable(IReachableContext context, bool useInSerialization = false) { // Already reachable? if (reachable != 0 && (!useInSerialization || usedInSerialization != 0)) { return; } // Mark it reachable bool reachableChanged = Interlocked.Exchange(ref reachable, 1) == 0; bool serializationChanged = useInSerialization && Interlocked.Exchange(ref usedInSerialization, 1) == 0; if (reachableChanged || serializationChanged) { if (context != null) { context.NewReachableDetected(); // Member was not yet walked, do it now unless its a type that is not in the project if (ShouldWalk(context, this)) { context.Walk(this); } } } }
/// <summary> /// Mark this type reachable. /// </summary> public void SetReachable(IReachableContext context) { // Already reachable? if (reachable != 0) { return; } // Mark it reachable if (Interlocked.Exchange(ref reachable, 1) == 0) { if (context != null) { context.NewReachableDetected(); // Member was not yet walked, do it now unless its a type that is not in the project if (ShouldWalk(context, this)) { context.Walk(this); } } } }