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


C# ArrayType类代码示例

本文整理汇总了C#中ArrayType的典型用法代码示例。如果您正苦于以下问题:C# ArrayType类的具体用法?C# ArrayType怎么用?C# ArrayType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: GetStringType

		public static ArrayType GetStringType(ResolutionContext ctxt, LiteralSubformat fmt = LiteralSubformat.Utf8)
		{
			ArrayType _t = null;

			if (ctxt != null && ctxt.ScopedBlock != null)
			{
				var obj = ctxt.ParseCache.LookupModuleName(ctxt.ScopedBlock.NodeRoot as DModule, "object").FirstOrDefault();

				if (obj != null)
				{
					string strType = fmt == LiteralSubformat.Utf32 ? "dstring" :
						fmt == LiteralSubformat.Utf16 ? "wstring" :
						"string";

					var strNode = obj[strType];

					if (strNode != null)
						foreach (var n in strNode) {
							_t = TypeDeclarationResolver.HandleNodeMatch(n, ctxt) as ArrayType;
							if (_t != null)
								break;
						}
				}
			}

			if (_t == null)
			{
				var ch = fmt == LiteralSubformat.Utf32 ? DTokens.Dchar :
					fmt == LiteralSubformat.Utf16 ? DTokens.Wchar : DTokens.Char;

				_t = new ArrayType(new PrimitiveType(ch, DTokens.Immutable));
			}

			return _t;
		}
开发者ID:DinrusGroup,项目名称:D_Parser,代码行数:35,代码来源:Evaluation.PrimaryExpression.cs

示例2: Execute

    public void Execute()
    {
        var assemblyContainsAttribute = ModuleDefinition.Assembly.CustomAttributes.ContainsAttribute("LogMinimalMessageAttribute");
        var moduleContainsAttribute = ModuleDefinition.CustomAttributes.ContainsAttribute("LogMinimalMessageAttribute");
        if (assemblyContainsAttribute || moduleContainsAttribute)
        {
            LogMinimalMessage = true;
        }
        FindReference();
        Init();
        var stringType = ModuleDefinition.TypeSystem.String.Resolve();
        ConcatMethod = ModuleDefinition.Import(stringType.FindMethod("Concat", "String", "String"));
        FormatMethod = ModuleDefinition.Import(stringType.FindMethod("Format", "String", "Object[]"));
        ObjectArray = new ArrayType(ModuleDefinition.TypeSystem.Object);

        FindExceptionType();
        foreach (var type in ModuleDefinition
            .GetTypes()
            .Where(x => (x.BaseType != null) && !x.IsEnum && !x.IsInterface))
        {
            ProcessType(type);
        }

        //TODO: ensure attributes dont exist on interfaces
        RemoveReference();
    }
开发者ID:GeorgeHahn,项目名称:Anotar,代码行数:26,代码来源:ModuleWeaver.cs

示例3: GetStringType

        public static ArrayType GetStringType(ResolverContextStack ctxt, LiteralSubformat fmt = LiteralSubformat.Utf8)
        {
            ArrayType _t = null;

            if (ctxt != null)
            {
                var obj = ctxt.ParseCache.LookupModuleName("object").First();

                string strType = fmt == LiteralSubformat.Utf32 ? "dstring" :
                    fmt == LiteralSubformat.Utf16 ? "wstring" :
                    "string";

                var strNode = obj[strType];

                if(strNode!=null && strNode.Count != 0)
                    _t = DResolver.StripAliasSymbol(TypeDeclarationResolver.HandleNodeMatch(strNode[0], ctxt)) as ArrayType;
            }

            if (_t == null)
            {
                var ch = fmt == LiteralSubformat.Utf32 ? DTokens.Dchar :
                    fmt == LiteralSubformat.Utf16 ? DTokens.Wchar : DTokens.Char;

                _t = new ArrayType(new PrimitiveType(ch, DTokens.Immutable),
                    new ArrayDecl
                    {
                        ValueType = new MemberFunctionAttributeDecl(DTokens.Immutable)
                        {
                            InnerType = new DTokenDeclaration(ch)
                        }
                    });
            }

            return _t;
        }
开发者ID:gavin-norman,项目名称:Mono-D,代码行数:35,代码来源:Evaluation.PrimaryExpression.cs

示例4: VisitArrayType

        public override bool VisitArrayType(ArrayType array, TypeQualifiers quals)
        {
            TypeMap typeMap;
            if (TypeMapDatabase.FindTypeMap(array, out typeMap) && typeMap.IsIgnored)
            {
                Ignore();
                return false;
            }

            if (array.SizeType != ArrayType.ArraySize.Constant)
                return true;

            var arrayElemType = array.Type.Desugar();

            Class @class;
            if (arrayElemType.TryGetClass(out @class) && @class.IsRefType)
                return true;

            PrimitiveType primitive;
            if ((arrayElemType.IsPrimitiveType(out primitive) && primitive != PrimitiveType.LongDouble) ||
                arrayElemType.IsPointerToPrimitiveType())
                return true;

            Ignore();
            return false;
        }
开发者ID:ymlai87416,项目名称:CppSharp,代码行数:26,代码来源:Types.cs

示例5: TyfoArray

        public void TyfoArray()
        {
            ArrayType arr = new ArrayType(PrimitiveType.Int32, 10);
            tyreffo.WriteDeclaration(arr, "a");

            string sExp = "int32 a[10]";
            Assert.AreEqual(sExp, sw.ToString());
        }
开发者ID:nemerle,项目名称:reko,代码行数:8,代码来源:TypeFormatterTests.cs

示例6: Tabularize

 public static void Tabularize(ArrayType a, string tasName)
 {
     ((ICDType)a.m_type).Tabularize(tasName);
     if (a.m_type.Constructed)
     {
         TypeAssigment newTas = ((ICDModule)a.m_module).CreateNewTypeAssigment(tasName, a.m_type, new List<string>());
         a.m_type = ReferenceType.CreateByName(newTas);
     }
 }
开发者ID:kia92798,项目名称:tinyasn1,代码行数:9,代码来源:ConstructedTypes.cs

示例7: VisitArray

 public void VisitArray(ArrayType at)
 {
     var addrEnd = rdr.Address + cbSize;
     for (int i = 0; at.IsUnbounded || i < at.Length; ++i)
     {
         if (!rdr.IsValid || addrEnd <= rdr.Address)
             return;
         at.ElementType.Accept(this);
     }
 }
开发者ID:relaxar,项目名称:reko,代码行数:10,代码来源:TypedDataDumper.cs

示例8: ScalarArray

        /// <summary>
        /// Инициализирует новый экземпляр класса <see cref="ScalarArray"/> с указанием его типа
        /// </summary>
        /// <param name="arrayType">Значение перечисления <see cref="ArrayType"/>, определяющая тип скалярного массива</param>
        private ScalarArray(ArrayType arrayType)
            : base(true)
        {
            if (arrayType < ArrayType.Scalar || arrayType > ArrayType.Double)
            {
                throw new ArgumentOutOfRangeException("arrayType");
            }

            Type = arrayType;
        }
开发者ID:KalinovDmitri,项目名称:OpenCV,代码行数:14,代码来源:ScalarArray.cs

示例9: VisitArray

 public void VisitArray(ArrayType at)
 {
     if (at.Length == 0)
     {
         scanner.Warn(Address, "User-specified arrays must have a non-zero size.");
         return;
     }
     for (int i = 0; i < at.Length; ++i)
     {
         at.ElementType.Accept(this);
     }
 }
开发者ID:relaxar,项目名称:reko,代码行数:12,代码来源:GlobalDataWorkItem.cs

示例10: MakeArrayType

        public static ArrayType MakeArrayType(this TypeReference self, int rank)
        {
            if (rank == 0)
                throw new ArgumentOutOfRangeException ("rank");

            var array = new ArrayType (self);

            for (int i = 1; i < rank; i++)
                array.Dimensions.Add (new ArrayDimension ());

            return array;
        }
开发者ID:ttRevan,项目名称:cecil,代码行数:12,代码来源:TypeReferenceRocks.cs

示例11: CheckSemantic

 public override void CheckSemantic(Scope scope, List<Error> errors)
 {
     //es añadido al scope en el CheckSemantic del TypeDeclarationSecuence si no esta redefinido incorrectamente
     TigerType elementsType = scope.GetType(ElementsTypeName);
     if (elementsType == null)
     {
         errors.Add(new Error(GetChild(1), "El tipo '{0}' no está definido en el ámbito actual", ElementsTypeName));
         HasError = true;
         RelatedType = new ArrayType(UndefinedType.UndefinedInstance, ElementsTypeName);
     }
     else
         RelatedType = new ArrayType(elementsType, ElementsTypeName);
 }
开发者ID:sandygk,项目名称:Tiger-Compiler,代码行数:13,代码来源:ArrayDecNode.cs

示例12: StructureContainingArray

        public void StructureContainingArray()
        {
            ArrayType a = new ArrayType(PrimitiveType.Int32, 4);

            StructureType s = new StructureType(null, 0) { Fields = { { 8, a } } };

            TypeVariable tv = store.CreateTypeVariable(factory);
            tv.Class.DataType = s;
            Assert.AreEqual(1, store.UsedEquivalenceClasses.Count);

            DataType dt = tv.Class.DataType.Accept(nct);
            Assert.AreEqual(1, store.UsedEquivalenceClasses.Count);
            Assert.AreEqual("(struct (8 (arr int32 4) a0008))", store.UsedEquivalenceClasses[0].DataType.ToString()); 
        }
开发者ID:gitter-badger,项目名称:reko,代码行数:14,代码来源:NestedComplexTypeExtractorTests.cs

示例13: VisitArray

 public override DataType VisitArray(ArrayType at)
 {
     if (insideComplexType)
     {
         var nctr = new NestedComplexTypeExtractor(factory, store);
         at.Accept(nctr);
         return at;
     }
     else
     {
         insideComplexType = true;
         return base.VisitArray(at);
     }
 }
开发者ID:relaxar,项目名称:reko,代码行数:14,代码来源:NestedComplexTypeExtractor.cs

示例14: CEB_BuildByteArrayFetch

 public void CEB_BuildByteArrayFetch()
 {
     var i = new Identifier("i", PrimitiveType.Word32, null);
     DataType arrayOfBytes = new ArrayType(PrimitiveType.Byte, 0);
     StructureType str = Struct(
         Fld(0x01000, arrayOfBytes));
     CreateTv(globals, Ptr32(str), Ptr32(PrimitiveType.Byte));
     CreateTv(i, PrimitiveType.Int32, PrimitiveType.Word32);
     var ceb = new ComplexExpressionBuilder(
         PrimitiveType.Byte,
         globals.TypeVariable.DataType,
         globals.TypeVariable.OriginalDataType,
         null,
         globals, i, 0x1000);
     ceb.Dereferenced = true;
     Assert.AreEqual("globals->a1000[i]", ceb.BuildComplex().ToString());
 }
开发者ID:nemerle,项目名称:reko,代码行数:17,代码来源:ComplexExpressionBuilderTests.cs

示例15: ArrayOfStructures

        public void ArrayOfStructures()
        {
            StructureType s = new StructureType();
            s.Fields.Add(0, PrimitiveType.Word32);
            s.Fields.Add(4, PrimitiveType.Real64);

            ArrayType a = new ArrayType(s, 0);

            TypeVariable tv = store.CreateTypeVariable(factory);
            tv.Class.DataType = a;
            Assert.AreEqual(1, store.UsedEquivalenceClasses.Count);

            tv.Class.DataType.Accept(nct);

            Assert.AreEqual(2, store.UsedEquivalenceClasses.Count);
            Assert.AreEqual("(arr Eq_2)", store.UsedEquivalenceClasses[0].DataType.ToString());
            Assert.AreEqual("(struct (0 word32 dw0000) (4 real64 r0004))", store.UsedEquivalenceClasses[1].DataType.ToString());
        }
开发者ID:relaxar,项目名称:reko,代码行数:18,代码来源:NestedComplexTypeExtractorTests.cs


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