SaveFileDialog should I use the FilterIndex property or the extension of the FileName property?
问题 The other day I had the following question SaveFileDialog AddExtension doesn't work as expected. Now a follow up question came to my mind. Should I use the FilterIndex property or the extension of the FileName property of the SaveFileDialog to decide under which file format I want to store the data? I've the following C# test code: var dialog = new SaveFileDialog(); dialog.AddExtension = true; dialog.DefaultExt = "txt"; dialog.Filter = "Text files (*.txt)|*.txt|XML files (*.xml)|*.xml";