如何在这里解决“引用的对象没有任何价值”.....
logDTO 对象具有字符串类型的属性。
一些属性的值是空的。它抛出上面引用的错误。我尝试使用 .ToString() 但仍然抛出错误。
Public Sub WriteJobLog(ByVal logDTO As JobLogDTO)
Dim strArray As String() = {logDTO.Mode.ToString(), logDTO.UniqueId.ToString(), logDTO.ThreadId.ToString(), _
logDTO.StartTime.ToString(), logDTO.FinishTime.ToString(), logDTO.TimeTaken.ToString(), _
logDTO.PropertyId.ToString(), logDTO.ChannelId.ToString(), logDTO.URL.ToString(), _
logDTO.ExceptionOrResult.ToString(), logDTO.AvblWorkerThread.ToString(), logDTO.AvblPortThread.ToString(), _
logDTO.AcqrdWorkerThread.ToString(), logDTO.AcqurdPortThread.ToString(), logDTO.JobsToProcess.ToString()}
Dim lLogObj As Logging = New Logging(JobType.JOB_TRANSACTTIONAL)
lLogObj.WriteLogFile(String.Join(Configuration.LogDelimiter, strArray))
End Sub
作业日志DTO
public class JobLogDTO
{
public string Mode { get; set; }
public string UniqueId { get; set; }
public string ThreadId { get; set; }
public string StartTime { get; set; }
public string FinishTime { get; set; }
public string TimeTaken { get; set; }
public string PropertyId { get; set; }
public string ChannelId { get; set; }
public string URL { get; set; }
public string ExceptionOrResult { get; set; }
public string AvblWorkerThread { get; set; }
public string AvblPortThread { get; set; }
public string AcqrdWorkerThread { get; set; }
public string AcqurdPortThread { get; set; }
public string JobsToProcess { get; set; }
}
更新:
logDTO 对象的值
AcqrdWorkerThread "24" String
AcqurdPortThread "24" String
AvblPortThread "400" String
AvblWorkerThread "399" String
ChannelId Nothing String
ExceptionOrResult Nothing String
FinishTime Nothing String
JobsToProcess "24" String
Mode "Parallel" String
PropertyId Nothing String
StartTime "04.04.2013 12:17:25" String
ThreadId "5" String
TimeTaken Nothing String
UniqueId "97693c1b-2bbc-4e40-a542-291568aeee4c" String
URL Nothing String