InlinedLocationReference.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / InlinedLocationReference.cs / 1305376 / InlinedLocationReference.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------

namespace System.Activities 
{
    using System; 
 
    class InlinedLocationReference : LocationReference
    { 
        LocationReference innerReference;
        Activity validAccessor;

        public InlinedLocationReference(LocationReference innerReference, Activity validAccessor) 
        {
            this.innerReference = innerReference; 
            this.validAccessor = validAccessor; 
        }
 
        protected override string NameCore
        {
            get
            { 
                return this.innerReference.Name;
            } 
        } 

        protected override Type TypeCore 
        {
            get
            {
                return this.innerReference.Type; 
            }
        } 
 
        public override Location GetLocation(ActivityContext context)
        { 
            if (context == null)
            {
                throw FxTrace.Exception.ArgumentNull("context");
            } 

            // We need to call ThrowIfDisposed explicitly since 
            // context.Activity does not check isDisposed 
            context.ThrowIfDisposed();
 
            if (!object.ReferenceEquals(context.Activity, this.validAccessor))
            {
                throw FxTrace.Exception.AsError(new InvalidOperationException(SR.InlinedLocationReferenceOnlyAccessibleByOwner(context.Activity, this.validAccessor)));
            } 

            try 
            { 
                context.AllowChainedEnvironmentAccess = true;
                return this.innerReference.GetLocation(context); 
            }
            finally
            {
                context.AllowChainedEnvironmentAccess = false; 
            }
        } 
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK