I'm looping through the attributes in one file and trying to write them to another file. I could solve the problem for some attribute types with a line like;
foreach (DicomItem attribute in file1.Dataset)
{
try
{
file.Dataset.Add(attribute.Tag,attribute.ToString());
}
catch (Exception e)
{
Debug.WriteLine(e);
}
}
However a lot of lines throw exceptions. Is there a reliable technique for handling this so I can just copy the attribute from one file into another without having to test each value, find its type and cast appropriately. I'm not sure how to handle the generic T that the Add method has,
Thanks,
James