當前位置: 首頁>>代碼示例>>C#>>正文


C# CollectionDataContract.RequiresMemberAccessForRead方法代碼示例

本文整理匯總了C#中CollectionDataContract.RequiresMemberAccessForRead方法的典型用法代碼示例。如果您正苦於以下問題:C# CollectionDataContract.RequiresMemberAccessForRead方法的具體用法?C# CollectionDataContract.RequiresMemberAccessForRead怎麽用?C# CollectionDataContract.RequiresMemberAccessForRead使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CollectionDataContract的用法示例。


在下文中一共展示了CollectionDataContract.RequiresMemberAccessForRead方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GenerateCollectionReaderHelper

 CodeGenerator GenerateCollectionReaderHelper(CollectionDataContract collectionContract, bool isGetOnlyCollection)
 {
     ilg = new CodeGenerator();
     bool memberAccessFlag = collectionContract.RequiresMemberAccessForRead(null);
     try
     {
         if (isGetOnlyCollection)
         {
             ilg.BeginMethod("Read" + collectionContract.StableName.Name + "FromXml" + "IsGetOnly", Globals.TypeOfXmlFormatGetOnlyCollectionReaderDelegate, memberAccessFlag);
         }
         else
         {
             ilg.BeginMethod("Read" + collectionContract.StableName.Name + "FromXml" + string.Empty, Globals.TypeOfXmlFormatCollectionReaderDelegate, memberAccessFlag);
         }
     }
     catch (SecurityException securityException)
     {
         if (memberAccessFlag && securityException.PermissionType.Equals(typeof(ReflectionPermission)))
         {
             collectionContract.RequiresMemberAccessForRead(securityException);
         }
         else
         {
             throw;
         }
     }
     InitArgs();
     DemandMemberAccessPermission(memberAccessFlag);
     collectionContractArg = ilg.GetArg(4);
     return ilg;
 }
開發者ID:nlh774,項目名稱:DotNetReferenceSource,代碼行數:31,代碼來源:XmlFormatReaderGenerator.cs

示例2: GenerateCollectionReaderHelper

 private CodeGenerator GenerateCollectionReaderHelper(CollectionDataContract collectionContract, bool isGetOnlyCollection)
 {
     this.ilg = new CodeGenerator();
     bool allowPrivateMemberAccess = collectionContract.RequiresMemberAccessForRead(null);
     try
     {
         if (isGetOnlyCollection)
         {
             this.ilg.BeginMethod("Read" + collectionContract.StableName.Name + "FromXmlIsGetOnly", Globals.TypeOfXmlFormatGetOnlyCollectionReaderDelegate, allowPrivateMemberAccess);
         }
         else
         {
             this.ilg.BeginMethod("Read" + collectionContract.StableName.Name + "FromXml" + string.Empty, Globals.TypeOfXmlFormatCollectionReaderDelegate, allowPrivateMemberAccess);
         }
     }
     catch (SecurityException exception)
     {
         if (!allowPrivateMemberAccess || !exception.PermissionType.Equals(typeof(ReflectionPermission)))
         {
             throw;
         }
         collectionContract.RequiresMemberAccessForRead(exception);
     }
     this.InitArgs();
     this.DemandMemberAccessPermission(allowPrivateMemberAccess);
     this.collectionContractArg = this.ilg.GetArg(4);
     return this.ilg;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:28,代碼來源:XmlFormatReaderGenerator.cs

示例3: GenerateCollectionReaderHelper

 private CodeGenerator GenerateCollectionReaderHelper(CollectionDataContract collectionContract, bool isGetOnlyCollection)
 {
     _ilg = new CodeGenerator();
     bool memberAccessFlag = collectionContract.RequiresMemberAccessForRead(null);
     try
     {
         if (isGetOnlyCollection)
         {
             BeginMethod(_ilg, "Read" + DataContract.SanitizeTypeName(collectionContract.StableName.Name) + "FromJson" + "IsGetOnly", typeof(JsonFormatGetOnlyCollectionReaderDelegate), memberAccessFlag);
         }
         else
         {
             BeginMethod(_ilg, "Read" + DataContract.SanitizeTypeName(collectionContract.StableName.Name) + "FromJson", typeof(JsonFormatCollectionReaderDelegate), memberAccessFlag);
         }
     }
     catch (SecurityException securityException)
     {
         if (memberAccessFlag)
         {
             collectionContract.RequiresMemberAccessForRead(securityException);
         }
         else
         {
             throw;
         }
     }
     InitArgs();
     _collectionContractArg = _ilg.GetArg(4);
     return _ilg;
 }
開發者ID:dotnet,項目名稱:corefx,代碼行數:30,代碼來源:JsonFormatReaderGenerator.cs

示例4: GenerateCollectionReaderHelper

 private CodeGenerator GenerateCollectionReaderHelper(CollectionDataContract collectionContract, bool isGetOnlyCollection)
 {
     _ilg = new CodeGenerator();
     bool memberAccessFlag = collectionContract.RequiresMemberAccessForRead(null, Globals.DataContractSerializationPatterns);
     try
     {
         if (isGetOnlyCollection)
         {
             _ilg.BeginMethod("Read" + collectionContract.StableName.Name + "FromXml" + "IsGetOnly", Globals.TypeOfXmlFormatGetOnlyCollectionReaderDelegate, memberAccessFlag);
         }
         else
         {
             _ilg.BeginMethod("Read" + collectionContract.StableName.Name + "FromXml" + string.Empty, Globals.TypeOfXmlFormatCollectionReaderDelegate, memberAccessFlag);
         }
     }
     catch (SecurityException securityException)
     {
         if (memberAccessFlag)
         {
             collectionContract.RequiresMemberAccessForRead(securityException, Globals.DataContractSerializationPatterns);
         }
         else
         {
             throw;
         }
     }
     InitArgs();
     _collectionContractArg = _ilg.GetArg(4);
     return _ilg;
 }
開發者ID:jsalvadorp,項目名稱:corefx,代碼行數:30,代碼來源:XmlFormatReaderGenerator.cs


注:本文中的CollectionDataContract.RequiresMemberAccessForRead方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。