I'm investigating C# and some code where the string:
sheet.Cells[startRowIndexHeader, 11].Value = _currentRowPowerContext.HighVoltageSubstationContext.LowSide.Cub.TryGetCaption();
is inserting some text value in some excel cell. When I tried to change this Cub by the string:
currentRowPowerContext.HighVoltageSubstationContext.LowSide.Cub.AttributeCaption = "My value";
I recived the message
Object reference does not point to an instance of an object
How to change the Cub value?
By the way the code of TryGetCaption() functions which I found in this script:
public static string TryGetCaption(this ClassifierItem value)
{
return value == null ? null : value.AttributeCaption;
}
public static string TryGetCaption(this DirectRoute value)
{
var routeAsIp = value as CustomTCPClientRoute;
if (routeAsIp != null)
return string.Format("{0}: {1}", routeAsIp.AttributeHostOrIP, routeAsIp.AttributePort);
return value == null ? null : value.Caption;
}
public static string TryGetCaption(this EnumerationItem value)
{
return value == null ? null : value.Caption;
}