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


C# Compilation.CreateArrayTypeSymbol方法代码示例

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


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

示例1: UpdateContext

        private void UpdateContext(Solution solution, Project project, Compilation compilation, ReflectionCache reflectionCache)
        {
            Solution = solution;
            Project = project;
            Compilation = compilation;
            ReflectionCache = reflectionCache;

//            var diagnostics = compilation.GetDiagnostics();
//            var mscorlib = compilation.GetReferencedAssemblySymbol(project.MetadataReferences.First());
//            var typeNames = mscorlib.TypeNames.OrderBy(x => x).ToArray();

            ObjectToString = compilation.ObjectType.GetMembers("ToString").OfType<IMethodSymbol>().Single();
            String = compilation.FindType("System.String");
            SpecialFunctions = compilation.FindType("System.Runtime.WootzJs.SpecialFunctions");
            DefaultOf = SpecialFunctions.GetMethod("DefaultOf");
            Char = compilation.FindType("System.Char");
            Byte = compilation.FindType("System.Byte");
            Int16 = compilation.FindType("System.Int16");
            Int32 = compilation.FindType("System.Int32");
            Int64 = compilation.FindType("System.Int64");
            SByte = compilation.FindType("System.SByte");
            UInt16 = compilation.FindType("System.UInt16");
            UInt32 = compilation.FindType("System.UInt32");
            UInt64 = compilation.FindType("System.UInt64");
            Single = compilation.FindType("System.Single");
            Double = compilation.FindType("System.Double");
            Decimal = compilation.FindType("System.Decimal");
            Exception = compilation.FindType("System.Exception");
            InternalInit = Exception.GetMethodByName("InternalInit");
            Assembly = compilation.FindType("System.Reflection.Assembly");
            AssemblyConstructor = Assembly.InstanceConstructors.Single();
            JsAttributeType = compilation.FindType("System.Runtime.WootzJs.JsAttribute");
            JsCompilerOptionsAttribute = compilation.FindType("System.Runtime.WootzJs.JsCompilerOptionsAttribute");
            PrecedesAttribute = compilation.FindType("System.Runtime.WootzJs.DependsOnAttribute");
            ObjectType = compilation.FindType("System.Object");
            GetType = ObjectType.GetMethod("GetType");
            ObjectReferenceEquals = (IMethodSymbol)ObjectType.GetMembers("ReferenceEquals").Single();
            ObjectCast = (IMethodSymbol)SpecialFunctions.GetMembers("ObjectCast").Single();
            ObjectCreateDelegate = (IMethodSymbol)SpecialFunctions.GetMembers("CreateDelegate").Single();
            TypeType = compilation.FindType("System.Type");
            TypeArray = compilation.CreateArrayTypeSymbol(TypeType);
            TypeConstructor = TypeType.InstanceConstructors.Single();
            TypeInit = (IMethodSymbol)TypeType.GetMembers("Init").Single();
            CreateTypeParameter = (IMethodSymbol)TypeType.GetMembers("CreateTypeParameter").Single();
            TypeIsInstanceOfType = (IMethodSymbol)TypeType.GetMembers("IsInstanceOfType").Single();
            Type_GetTypeFromTypeFunc = (IMethodSymbol)TypeType.GetMembers("_GetTypeFromTypeFunc").Single();
            GetField = TypeType.GetMethod("GetField", String);
            GetProperty = TypeType.GetMethod("GetProperty", String);
            GetMethod = TypeType.GetMethod("GetMethod", String, TypeArray);
            GetConstructor = TypeType.GetMethod("GetConstructor", TypeArray);
            AsExtensionType = compilation.FindType("System.Runtime.WootzJs.AsExtension");
            JsniType = compilation.FindType("System.Runtime.WootzJs.Jsni");
            EnumType = compilation.FindType("System.Enum");
            EnumGetValue = EnumType.GetMethod("GetValue");
            EnumInternalToObject = EnumType.GetMethod("InternalToObject");
            Enumerable = compilation.FindType("System.Collections.IEnumerable");
            EnumerableGeneric = compilation.FindType("System.Collections.Generic.IEnumerable`1");
            Enumerator = compilation.FindType("System.Collections.IEnumerator");
            EnumerableGetEnumerator = (IMethodSymbol)Enumerable.GetMembers("GetEnumerator").Single();
            EnumeratorCurrent = (IPropertySymbol)Enumerator.GetMembers("Current").Single();
            EnumeratorMoveNext = (IMethodSymbol)Enumerator.GetMembers("MoveNext").Single();
            DelegateType = compilation.FindType("System.Delegate");
            DelegateTypeConstructor = DelegateType.InstanceConstructors.Single();
            DelegateTarget = (IPropertySymbol)DelegateType.GetMembers("Target").Single();
            DelegateCombine = DelegateType.GetMembers("Combine").OfType<IMethodSymbol>().Single(x => x.Parameters.Count() == 2 && x.Parameters.All(y => Equals(y.Type, DelegateType)));
            DelegateRemove = DelegateType.GetMembers("Remove").OfType<IMethodSymbol>().Single(x => x.Parameters.Count() == 2 && x.Parameters.All(y => Equals(y.Type, DelegateType)));
            MulticastDelegateType = compilation.FindType("System.MulticastDelegate");
            MulticastDelegateConstructor = MulticastDelegateType.InstanceConstructors.Single(x => x.Parameters.Last().Type.TypeKind == TypeKind.Array);
            NullableType = compilation.FindType("System.Nullable`1");
            CharNullable = NullableType.Construct(Char);
            NullableHasValue = (IPropertySymbol)NullableType.GetMembers("HasValue").Single();
            NullableValue = (IPropertySymbol)NullableType.GetMembers("Value").Single();
            NullableGetValueOrDefault = (IMethodSymbol)NullableType.GetMembers("GetValueOrDefault").Single();
            FieldInfo = compilation.FindType("System.Reflection.FieldInfo");
            MethodInfo = compilation.FindType("System.Reflection.MethodInfo");
            MemberInfo = compilation.FindType("System.Reflection.MemberInfo");
            PropertyInfo = compilation.FindType("System.Reflection.PropertyInfo");
            EventInfo = compilation.FindType("System.Reflection.EventInfo");
            ConstructorInfo = compilation.FindType("System.Reflection.ConstructorInfo");
            Attribute = compilation.FindType("System.Attribute");
            FieldInfoConstructor = FieldInfo.InstanceConstructors.Single();
            MethodInfoConstructor = MethodInfo.InstanceConstructors.Single();
            ParameterInfo = compilation.FindType("System.Reflection.ParameterInfo");
            ParameterInfoConstructor = ParameterInfo.InstanceConstructors.Single();
            PropertyInfoConstructor = PropertyInfo.InstanceConstructors.Single();
            EventInfoConstructor = EventInfo.InstanceConstructors.Single();
            ConstructorInfoConstructor = ConstructorInfo.InstanceConstructors.Single();
            TypeAttributes = compilation.FindType("System.Reflection.TypeAttributes");
            TypeAttributesPublic = (IFieldSymbol)TypeAttributes.GetMembers("Public").Single();
            TypeAttributesNotPublic = (IFieldSymbol)TypeAttributes.GetMembers("NotPublic").Single();
            TypeAttributesNestedPublic = (IFieldSymbol)TypeAttributes.GetMembers("NestedPublic").Single();
            TypeAttributesNestedPrivate = (IFieldSymbol)TypeAttributes.GetMembers("NestedPrivate").Single();
            TypeAttributesNestedFamily = (IFieldSymbol)TypeAttributes.GetMembers("NestedFamily").Single();
            TypeAttributesNestedAssembly = (IFieldSymbol)TypeAttributes.GetMembers("NestedAssembly").Single();
            TypeAttributesNestedFamANDAssem = (IFieldSymbol)TypeAttributes.GetMembers("NestedFamANDAssem").Single();
            TypeAttributesNestedFamORAssem = (IFieldSymbol)TypeAttributes.GetMembers("NestedFamORAssem").Single();
            TypeAttributesAbstract = (IFieldSymbol)TypeAttributes.GetMembers("Abstract").Single();
            TypeAttributesSealed = (IFieldSymbol)TypeAttributes.GetMembers("Sealed").Single();
            TypeAttributesClass = (IFieldSymbol)TypeAttributes.GetMembers("Class").Single();
            TypeAttributesInterface = (IFieldSymbol)TypeAttributes.GetMembers("Interface").Single();
//.........这里部分代码省略.........
开发者ID:x335,项目名称:WootzJs,代码行数:101,代码来源:Context.cs


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