Click here to Skip to main content
15,888,521 members
Home / Discussions / C#
   

C#

 
GeneralRe: Task.Wait() -Why?? Pin
Richard Deeming6-Apr-17 1:30
mveRichard Deeming6-Apr-17 1:30 
Questionin which scenario people use factory design patter Pin
Tridip Bhattacharjee4-Apr-17 1:58
professionalTridip Bhattacharjee4-Apr-17 1:58 
AnswerRe: in which scenario people use factory design patter Pin
Eddy Vluggen4-Apr-17 2:29
professionalEddy Vluggen4-Apr-17 2:29 
GeneralRe: in which scenario people use factory design patter Pin
Tridip Bhattacharjee4-Apr-17 3:48
professionalTridip Bhattacharjee4-Apr-17 3:48 
GeneralRe: in which scenario people use factory design patter Pin
Pete O'Hanlon4-Apr-17 4:14
mvePete O'Hanlon4-Apr-17 4:14 
GeneralRe: in which scenario people use factory design patter Pin
Gerry Schmitz4-Apr-17 4:36
mveGerry Schmitz4-Apr-17 4:36 
GeneralRe: in which scenario people use factory design patter Pin
Eddy Vluggen4-Apr-17 5:24
professionalEddy Vluggen4-Apr-17 5:24 
QuestionStrange Problem Loading Config File Pin
Kevin Marois3-Apr-17 7:51
professionalKevin Marois3-Apr-17 7:51 
I'm trying to load a config file from a location other than the app.

// Get the full path and name of the app's Config file.
var configFileName = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
This returns '.....\bin\Debug\OQRangeDataInput.exe.Config', which is correct

Then I do this to load the config file
_configuration = ConfigurationManager.OpenExeConfiguration(configFileName);

The next line, the OpenExeConfigation sets a property on the Configuration called FilePath which is set to '.....\bin\Debug\OQRangeDataInput.exe.Config.config'
this is clearly wrong.

I had to add this right after the first line to fix it
configFileName = configFileName.ToLower().Replace(".config", "");

So, all told, I now have this
private void LoadConfigFile()
{
    var configFileName = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;

    // For some reason ConfigurationManager.OpenExeConfiguration adds ".config" to the end
    // of the file name, so it appears as "app.exe.config.config"
    configFileName = configFileName.ToLower().Replace(".config", "");

    _configuration = ConfigurationManager.OpenExeConfiguration(configFileName);

    AppConfigFile = configFileName;
}

Anyone see what's wrong? Is this some kind of bug, or am I just doing it wrong?

Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

AnswerRe: Strange Problem Loading Config File Pin
Richard Deeming3-Apr-17 8:03
mveRichard Deeming3-Apr-17 8:03 
GeneralRe: Strange Problem Loading Config File Pin
Kevin Marois3-Apr-17 8:07
professionalKevin Marois3-Apr-17 8:07 
QuestionUnderstanding IOC Pin
Liagapi2-Apr-17 21:06
Liagapi2-Apr-17 21:06 
AnswerRe: Understanding IOC Pin
Pete O'Hanlon2-Apr-17 22:41
mvePete O'Hanlon2-Apr-17 22:41 
GeneralRe: Understanding IOC Pin
Liagapi3-Apr-17 16:32
Liagapi3-Apr-17 16:32 
GeneralRe: Understanding IOC Pin
Pete O'Hanlon3-Apr-17 20:41
mvePete O'Hanlon3-Apr-17 20:41 
AnswerRe: Understanding IOC Pin
Bernhard Hiller3-Apr-17 21:24
Bernhard Hiller3-Apr-17 21:24 
AnswerRe: Understanding IOC Pin
Gerry Schmitz4-Apr-17 4:46
mveGerry Schmitz4-Apr-17 4:46 
AnswerRe: Understanding IOC Pin
Matthew Dennis4-Apr-17 6:43
sysadminMatthew Dennis4-Apr-17 6:43 
QuestionWindows Application C# Pin
Member 130625052-Apr-17 9:38
Member 130625052-Apr-17 9:38 
AnswerRe: Windows Application C# Pin
OriginalGriff2-Apr-17 10:15
mveOriginalGriff2-Apr-17 10:15 
AnswerRe: Windows Application C# Pin
Michael_Davies2-Apr-17 10:16
Michael_Davies2-Apr-17 10:16 
AnswerRe: Windows Application C# Pin
ZurdoDev3-Apr-17 1:33
professionalZurdoDev3-Apr-17 1:33 
QuestionWrong absolute position of a QRcode Pin
advn1-Apr-17 4:23
advn1-Apr-17 4:23 
AnswerRe: Wrong absolute position of a QRcode Pin
ZurdoDev3-Apr-17 3:43
professionalZurdoDev3-Apr-17 3:43 
QuestionSearching & Playing Itunes music(streaming) tracks Pin
Member 130990653-Apr-17 2:54
Member 130990653-Apr-17 2:54 
Questionrecreating excel spreadsheet in visual studio Pin
ef3731-Mar-17 3:55
ef3731-Mar-17 3:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.