本文介绍了循环数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

循环出现错误.这是错误.任何帮助将不胜感激

对象引用未设置为对象的实例.

Object reference not set to an instance of an object. 

MetadataWebService.metadataValueCriteria [] metaCriteria =新的MetadataWebService.metadataValueCriteria [7];
                             metaCriteria.Initialize();
                             metaCriteria [0] =新的MetadataWebService.metadataValueCriteria();
                             metaCriteria [1] .metadataShortName ="empld";
                             metaCriteria [2] .metadataShortName =文档标题";
                             metaCriteria [3] .metadataShortName =姓氏";
                             metaCriteria [4] .metadataShortName =名字";
                             metaCriteria [5] .metadataShortName =中间名";
                             metaCriteria [6] .metadataShortName ="Term";
                             metaCriteria [7] .metadataShortName =索引日期";

MetadataWebService.metadataValueCriteria[] metaCriteria = new MetadataWebService.metadataValueCriteria[7];
                metaCriteria.Initialize();
                metaCriteria[0] = new MetadataWebService.metadataValueCriteria();
                metaCriteria[1].metadataShortName = "empld";
                metaCriteria[2].metadataShortName = "Document Title";
                metaCriteria[3].metadataShortName = "Last Name";
                metaCriteria[4].metadataShortName = "First Name";
                metaCriteria[5].metadataShortName = "Middle Name";
                metaCriteria[6].metadataShortName = "Term";
                metaCriteria[7].metadataShortName = "Index Date";

              MetadataWebService.MetadataValueWebServices meta =新的MetadataWebService.MetadataValueWebServices();

              BpmMetadataWebService.metadataValueDTO [] metaDTO = meta.getByCriteria(metaCriteria);

         //foreach(metaCriteria中的字符串s)
                             for(int i = 0; i< metaCriteria.Length; i ++)
                             {

               // foreach (string s in metaCriteria)
                for (int i = 0; i < metaCriteria.Length; i++)
                {

;  Response.Write(" br" + metaDTO [i] .metadataId.ToString());

              }

推荐答案

因为我不知道这个确切的代码,所以我会说"  metaDTO [i] .metadataId "尚未初始化 (完全是metadataid).签出来.

since I dont know this exact code, I would say " metaDTO[i].metadataId" is not been initialized (metadataid exactly). Check it out.


这篇关于循环数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 07:04