private static void DemandSecurityPermissionIfCustomPackage(Package package)
 {
     // Although ZipPackage is sealed and cannot be subclassed, we shouldn't depend on
     //  the "sealedness" of ZipPackage. Checking the object type is more reliable way
     //  than using "as" or "is" operator.
     if (package != null && package.GetType() != typeof(ZipPackage))
     {
         SecurityHelper.DemandEnvironmentPermission();
     }
 }
Esempio n. 2
0
 private static void DemandSecurityPermissionIfCustomPackage(Package package) 
 {
     // Although ZipPackage is sealed and cannot be subclassed, we shouldn't depend on
     //  the "sealedness" of ZipPackage. Checking the object type is more reliable way
     //  than using "as" or "is" operator. 
     if (package != null && package.GetType() != typeof(ZipPackage))
     { 
         SecurityHelper.DemandEnvironmentPermission(); 
     }
 }