/ Published in: C#
                    
                                        
Single-line expression provides .CFG filename based on application name.
The .CFG file is in the same directory as the application.
Application.ExecutablePath returns the app's path, with directory, including the trailing .EXE.
Regex is used to replace the .EXE with a .CFG or .INI
                The .CFG file is in the same directory as the application.
Application.ExecutablePath returns the app's path, with directory, including the trailing .EXE.
Regex is used to replace the .EXE with a .CFG or .INI
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
// Evaluates to something of the form "C:\AppDirectory\AppName.cfg".
static private string filename = System.Text.RegularExpressions.Regex.Replace( Application.ExecutablePath, "\\.exe$", ".cfg", System.Text.RegularExpressions.RegexOptions.IgnoreCase );
Comments
 Subscribe to comments
                    Subscribe to comments
                
                