我想在我的方法中返回一个 OrderedDictionary,但我的代码有错误...
我不知道为什么我不能这样做:
public OrderedDictionary getAllPortsInformations()
{
OrderedDictionary SerialPort = filtreXml("/catalog/cd/SerialPort", "SerialPort");
OrderedDictionary BaudRate = filtreXml("/catalog/cd/BaudRate", "BaudRate");
OrderedDictionary DataBits = filtreXml("/catalog/cd/DataBits", "DataBits");
OrderedDictionary StopBits = filtreXml("/catalog/cd/StopBits", "StopBits");
OrderedDictionary ParityBits = filtreXml("/catalog/cd/ParityBits", "ParityBits");
OrderedDictionary ReadTimeout = filtreXml("/catalog/cd/ReadTimeout", "ReadTimeout");
OrderedDictionary WriteTimeout = filtreXml("/catalog/cd/WriteTimeout", "WriteTimeout");
OrderedDictionary PinCode = filtreXml("/catalog/cd/PinCode", "PinCode");
OrderedDictionary output = new OrderedDictionary();
foreach (DictionaryEntry sp in SerialPort)
output.Add(sp.Key, sp.Value);
foreach (DictionaryEntry br in BaudRate)
output.Add(br.Key, br.Value);
foreach (DictionaryEntry db in DataBits)
output.Add(db.Key, db.Value);
foreach (DictionaryEntry sb in StopBits)
output.Add(sb.Key, sb.Value);
foreach (DictionaryEntry pb in ParityBits)
output.Add(pb.Key, pb.Value);
foreach (DictionaryEntry rt in ReadTimeout)
output.Add(rt.Key, rt.Value);
foreach (DictionaryEntry wt in WriteTimeout)
output.Add(wt.Key, wt.Value);
foreach (DictionaryEntry pc in PinCode)
output.Add(pc.Key, pc.Value);
return output;
}
错误信息
错误:错误 1 'application.Xml.getAllPortsInformations ()':所有代码路径不一定都返回值