I am trying to use a set of conditional statements that will create an enumeration related to [Flags]. However, the compiler complains that "m" is not assigned. How can I rewrite the following to achieve my intended functionality?
Media m;
if (filterOptions.ShowAudioFiles)
m = m | Media.Audio;
if (filterOptions.ShowDocumentFiles)
m = m | Media.Document;
if (filterOptions.ShowImageFiles)
m = m | Media.Image;
if (filterOptions.ShowVideoFiles)
m = m | Media.Video;
source
share