我的字典声明如下如何在C#
public static Dictionary<object, DataInfo> DataDic = new Dictionary<object, DataInfo>();
public class DataInfo
{
public string DSPER; // Data Sample Period
public int TOTSMP; // Total Samples to be made
public int REPGSZ; // Report Group Size
public List<int> IDList; // Array List to collect all the enabled IDs
}
功能InitDataDic
下面叫,我怎么能写的重新分配tdi.TOTSMP后的字典.Remove()
和.Add()
的代码更新复杂的字典值的某些部分= 0在true
条件下以简单的方式。
public void InitDataDic (object objid, DataInfo datainfo, int totsmp)
{
DataInfo tdi = new DataInfo();
object trid = objid;
tdi = datainfo;
if (DataDic.ContainsKey(trid) == true)
{
DataDic.Remove(trid); // here, i mentioned above
tdi.TOTSMP = 0;
DataDic.Add(trid, tdi); // here, i mentioned above
}
else
{
tdi.TOTSMP = topsmp;
DataDic.Add(trid, tdi);
}
}
有没有人建议您致电领域,而不是''DataSamplePeriod' DSPER'(这是不可读和神秘的),同样为所有其他人呢? – Timwi 2010-08-30 07:28:48
@Timwi,简短的'DSPER'来自SEMI E5标准手册。当然这是有点难以理解和神秘的。实际上,它非常好地匹配了标准手册中定义的参数。谢谢。 – 2010-08-31 05:37:15
因此,你永远在别人的错误,而不是主动去解决它,你可以。 – Timwi 2010-08-31 07:40:19