当前位置: 首页>>代码示例>>C#>>正文


C# AssemblyDefinition.SelectMany方法代码示例

本文整理汇总了C#中Mono.Cecil.AssemblyDefinition.SelectMany方法的典型用法代码示例。如果您正苦于以下问题:C# AssemblyDefinition.SelectMany方法的具体用法?C# AssemblyDefinition.SelectMany怎么用?C# AssemblyDefinition.SelectMany使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mono.Cecil.AssemblyDefinition的用法示例。


在下文中一共展示了AssemblyDefinition.SelectMany方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Create

        public static NamespaceInfo[] Create(AssemblyDefinition[] targetAssemblies)
        {
            var garbageTypeList = new[]
            {
                "AVPlayerItemLegibleOutputPushDelegate"
                // NB: Aparrently this used to break "build on device because of reasons". We don't know what these reasons are and this may not be needed anymore.
            };

            var publicDelegateTypes = targetAssemblies
                .SelectMany(x => SafeTypes.GetSafeTypes(x))
                .Where(x => x.IsPublic && !x.IsInterface && !x.HasGenericParameters && IsCocoaDelegateName(x.Name))
                .Where(x => x.BaseType == null || !x.BaseType.FullName.Contains("MulticastDelegate"))
                .Where(x => !garbageTypeList.Any(y => x.FullName.Contains(y)))
                .Select(x => new {Type = x, Delegates = GetPublicDelegateMethods(x)})
                .Where(x => x.Delegates.Length > 0)
                .ToArray();

            var namespaceData = publicDelegateTypes
                .GroupBy(x => x.Type.Namespace)
                //.Where(x => !garbageNamespaceList.Contains(x.Key))    // NB: We don't know why this is disabled.
                .Select(x => new NamespaceInfo
                {
                    Name = x.Key,
                    Types = x.Select(y => new PublicTypeInfo
                    {
                        Name = y.Type.Name,
                        Type = y.Type,
                        Abstract = y.Type.IsAbstract ? "abstract" : "",
                        ZeroParameterMethods =
                            y.Delegates.Where(z => z.Parameters.Count == 0).Select(z => new ParentInfo
                            {
                                Name = z.Name
                            }).ToArray(),
                        SingleParameterMethods =
                            y.Delegates.Where(z => z.Parameters.Count == 1).Select(z => new SingleParameterMethod
                            {
                                Name = z.Name,
                                ParameterType = z.Parameters[0].ParameterType.FullName,
                                ParameterName = z.Parameters[0].Name
                            }).ToArray(),
                        MultiParameterMethods =
                            y.Delegates.Where(z => z.Parameters.Count > 1).Select(z => new MultiParameterMethod
                            {
                                Name = z.Name,
                                ParameterList =
                                    string.Join(", ",
                                        z.Parameters.Select(
                                            a => string.Format("{0} {1}", a.ParameterType.FullName, a.Name))),
                                ParameterTypeList =
                                    string.Join(", ", z.Parameters.Select(a => a.ParameterType.FullName)),
                                ParameterNameList = string.Join(", ", z.Parameters.Select(a => a.Name))
                            }).ToArray()
                    }).ToArray()
                }).ToArray();

            return namespaceData;
        }
开发者ID:reactiveui,项目名称:ReactiveUI,代码行数:57,代码来源:DelegateTemplateInformation.cs

示例2: CreateEventTemplateInformation

        public static NamespaceInfo[] CreateEventTemplateInformation(AssemblyDefinition[] targetAssemblies)
        {
            var publicTypesWithEvents = targetAssemblies
                .SelectMany(x => SafeGetTypes(x))
                .Where(x => x.IsPublic && !x.HasGenericParameters)
                .Select(x => new { Type = x, Events = GetPublicEvents(x) })
                .Where(x => x.Events.Length > 0)
                .ToArray();

            var garbageNamespaceList = new[] {
                "Windows.UI.Xaml.Data",
                "Windows.UI.Xaml.Interop",
                "Windows.UI.Xaml.Input",
                "MonoTouch.AudioToolbox",
                "MonoMac.AudioToolbox",
                "ReactiveUI.Events",
            };

            var namespaceData = publicTypesWithEvents
                .GroupBy(x => x.Type.Namespace)
                .Where(x => !garbageNamespaceList.Contains(x.Key))
                .Select(x => new NamespaceInfo() {
                    Name = x.Key,
                    Types = x.Select(y => new PublicTypeInfo() {
                        Name = y.Type.Name,
                        Type = y.Type,
                        Events = y.Events.Select(z => new PublicEventInfo() {
                            Name = z.Name,
                            EventHandlerType = GetRealTypeName(z.EventType),
                            EventArgsType = GetEventArgsTypeForEvent(z),
                        }).ToArray(),
                    }).ToArray()
                }).ToArray();

            foreach (var type in namespaceData.SelectMany(x => x.Types)) {
                var parentWithEvents = GetParents(type.Type).FirstOrDefault(x => GetPublicEvents(x).Any());
                if (parentWithEvents == null) continue;

                type.Parent = new ParentInfo() { Name = parentWithEvents.FullName };
            }

            return namespaceData;
        }
开发者ID:Wagnerp,项目名称:ReactiveUI,代码行数:43,代码来源:EventBuilder.cs

示例3: CreateDelegateTemplateInformation

        public static NamespaceInfo[] CreateDelegateTemplateInformation(AssemblyDefinition[] targetAssemblies)
        {
            var garbageTypeList = new[] {
                "AVPlayerItemLegibleOutputPushDelegate",  // NB: Breaks build on device because reasons.
            };

            var publicDelegateTypes = targetAssemblies
                .SelectMany(x => SafeGetTypes(x))
                .Where(x => x.IsPublic && !x.IsInterface && !x.HasGenericParameters && isCocoaDelegateName(x.Name))
                .Where(x => x.BaseType == null || !x.BaseType.FullName.Contains("MulticastDelegate"))
		.Where(x => !garbageTypeList.Any(y => x.FullName.Contains(y)))
                .Select(x => new { Type = x, Delegates = GetPublicDelegateMethods(x) })
                .Where(x => x.Delegates.Length > 0)
                .ToArray();

            var namespaceData = publicDelegateTypes
                .GroupBy(x => x.Type.Namespace)
                //.Where(x => !garbageNamespaceList.Contains(x.Key))
                .Select(x => new NamespaceInfo() {
                    Name = x.Key,
                    Types = x.Select(y => new PublicTypeInfo() {
                        Name = y.Type.Name,
                        Type = y.Type,
                        Abstract = y.Type.IsAbstract ? "abstract" : "",
                        ZeroParameterMethods = y.Delegates.Where(z => z.Parameters.Count == 0).Select(z => new ParentInfo() {
                            Name = z.Name,
                        }).ToArray(),
                        SingleParameterMethods = y.Delegates.Where(z => z.Parameters.Count == 1).Select(z => new SingleParameterMethod() {
                            Name = z.Name,
                            ParameterType = z.Parameters[0].ParameterType.FullName,
                            ParameterName = z.Parameters[0].Name,
                        }).ToArray(),
                        MultiParameterMethods = y.Delegates.Where(z => z.Parameters.Count > 1).Select(z => new MultiParameterMethod() {
                            Name = z.Name,
                            ParameterList = String.Join(", ", z.Parameters.Select(a => String.Format("{0} {1}", a.ParameterType.FullName, a.Name))),
                            ParameterTypeList = String.Join(", ", z.Parameters.Select(a => a.ParameterType.FullName)),
                            ParameterNameList = String.Join(", ", z.Parameters.Select(a => a.Name)),
                        }).ToArray(),
                    }).ToArray()
                }).ToArray();

            return namespaceData;
        }
开发者ID:Wagnerp,项目名称:ReactiveUI,代码行数:43,代码来源:EventBuilder.cs


注:本文中的Mono.Cecil.AssemblyDefinition.SelectMany方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。