Have a look at the following piece of code:
string currentIDString = SegmentFilter.GetSegmentFilterID();
Sitecore.Data.ID currentID = null;
if (!String.IsNullOrEmpty(currentIDString))
{
currentID = new Sitecore.Data.ID(currentIDString);
}
if (currentID != null)
{
// some code
}
This seems perfectly okay. However the last if-statement produces the following error message at compile time:
The call is ambiguous between the following methods or properties: 'Sitecore.Data.ID.operator !=(Sitecore.Data.ID, Sitecore.Data.ShortID)' and 'Sitecore.Data.ID.operator !=(Sitecore.Data.ID, Sitecore.Data.ID)'
I do not really understand the reason for this error message. But the following piece of code is a good alternative approach:
string currentIDString = SegmentFilter.GetSegmentFilterID();
Sitecore.Data.ID currentID = new Sitecore.Data.ID(Guid.Empty);
if (!String.IsNullOrEmpty(currentIDString))
{
currentID = new Sitecore.Data.ID(currentIDString);
}
if (!Sitecore.Data.ID.IsNullOrEmpty(currentID))
{
// some code
}