示例#1
0
文件: Commons.cs 项目: PlumpMath/CAM
 private static void InitFields(
     ref CILElementKind cilKind,
     ref LazyWithLock <ListProxy <CILCustomAttribute> > attributesField,
     CILElementKind kind,
     LazyWithLock <ListProxy <CILCustomAttribute> > attributes
     )
 {
     cilKind         = kind;
     attributesField = attributes;
 }
示例#2
0
文件: Commons.cs 项目: PlumpMath/CAM
 internal CILCustomAttributeContainerImpl(
     CILReflectionContextImpl ctx,
     CILElementKind kind,
     Int32 anID,
     LazyWithLock <ListProxy <CILCustomAttribute> > cAttrDataFunc
     )
     : base(ctx, anID)
 {
     InitFields(
         ref this.cilKind,
         ref this.attributes,
         kind,
         cAttrDataFunc
         );
 }
示例#3
0
文件: Commons.cs 项目: PlumpMath/CAM
        internal CILCustomAttributeContainerImpl(
            CILReflectionContextImpl ctx,
            Int32 anID,
            CILElementKind kind,
            Func <CustomAttributeDataEventArgs> evtArgsFunc
            )
            : base(ctx, anID)
        {
            ArgumentValidator.ValidateNotNull("Reflection context", ctx);

            InitFields(
                ref this.cilKind,
                ref this.attributes,
                kind,
                new LazyWithLock <ListProxy <CILCustomAttribute> >(() =>
            {
                var evtArgs = evtArgsFunc();
                ctx.LaunchCustomAttributeDataLoadEvent(evtArgs);
                var thisElement = (CILCustomAttributeContainer)this.context.Cache.ResolveAnyID(this.cilKind, this.id);
                return(ctx.CollectionsFactory.NewListProxy <CILCustomAttribute>(new List <CILCustomAttribute>(evtArgs.CustomAttributeData.Select(tuple => CILCustomAttributeFactory.NewAttribute(thisElement, tuple.Item1, tuple.Item2, tuple.Item3)))));
            })
                );
        }