Aug 17, 2012 at 9:06 PM
Edited Aug 17, 2012 at 9:08 PM
As soon as you access the read-only frame property, the corresponding frame structure is created in-memory and added to the tag object. This was done to help avoid the need for null checks and simplify the programming model.
For example, if you wanted to access the Title property, you could do one of the following, regardless of whether a Title frame existed:
//Using the implicit cast operator
string title = tag.Title;
//Using the Value property
string title = tag.Title.Value;
You do not need to explicitly check whether the tag.Title property is null or not; in fact, in this model, the property will never be null. If the frame did not exist in the tag, then the above code would return an empty string.
Automatically adding empty frames to the tag will not cause any side effects. These are only in-memory, and if you were to write the tag back to the MP3 file, empty frames would be ignored.
If your logic requires that you check whether the frame exists in the tag, then you can used the frame's IsAssigned property like this:
//your logic here
Thanks for the question. Hope this helps.