Click here to Skip to main content
16,014,472 members
Home / Discussions / C#
   

C#

 
AnswerRe: Program hangs... Pin
Harvey Saayman11-Oct-10 1:07
Harvey Saayman11-Oct-10 1:07 
AnswerRe: Program hangs... Pin
Luc Pattyn11-Oct-10 1:17
sitebuilderLuc Pattyn11-Oct-10 1:17 
AnswerRe: Program hangs... Pin
#realJSOP11-Oct-10 2:38
professional#realJSOP11-Oct-10 2:38 
AnswerCode... Pin
ayandelhi11-Oct-10 4:44
ayandelhi11-Oct-10 4:44 
GeneralRe: Code... Pin
ayandelhi11-Oct-10 6:25
ayandelhi11-Oct-10 6:25 
GeneralRe: Code... Pin
Pete O'Hanlon11-Oct-10 6:43
mvePete O'Hanlon11-Oct-10 6:43 
GeneralRe: Code... Pin
ayandelhi11-Oct-10 7:07
ayandelhi11-Oct-10 7:07 
QuestionAccess the ConfigSection of specified config file Pin
AndieDu10-Oct-10 18:59
AndieDu10-Oct-10 18:59 
Dear All

ConfigurationManager.GetSection("Section1") only retrieve the default app.config's section information and it returns a object that can be casted. Now i have a specified configuration that used by my application. I have loaded the specified configuration file into the memory, please see the below code:

this is the specified config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
	<section name="Section1" type="CortexShell.DisplayModeSectionHandler,CortexShell" />
  </configSections>
    <Section1 DisplayMode="MonitorDisplay" Timeout="300" />
</configuration>


this is the c# code:
Configuration config = ConfigurationManager.OpenExeConfiguration(@"c:\AppState.config");
ExeConfigurationFileMap map = new ExeConfigurationFileMap();
map.ExeConfigFilename = path;
config = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None);
DisplayModeSection _displayMode = (DisplayModeSection)config.GetSection("Section1");       


Now the config.GetSection("Section1") only returns the specified configuration.ConfigurationSection object, hence when i compile it, this is the exception: Cannot convert type 'System.Configuration.ConfigurationSection' to 'CortexShell.DisplayModeSection', my question is how can i convert System.Configuration.ConfigurationSection to CortexShell.DisplayModeSection (this is my customised config section in the specified config file)

Thanks very much
QuestionCancel on ThreadPool queued executions? Pin
devvvy10-Oct-10 17:47
devvvy10-Oct-10 17:47 
AnswerRe: Cancel on ThreadPool queued executions? Pin
Harvey Saayman10-Oct-10 21:29
Harvey Saayman10-Oct-10 21:29 
GeneralRe: Cancel on ThreadPool queued executions? Pin
devvvy11-Oct-10 2:49
devvvy11-Oct-10 2:49 
GeneralRe: Cancel on ThreadPool queued executions? Pin
Harvey Saayman11-Oct-10 2:52
Harvey Saayman11-Oct-10 2:52 
AnswerRe: Cancel on ThreadPool queued executions? Pin
Luc Pattyn11-Oct-10 1:23
sitebuilderLuc Pattyn11-Oct-10 1:23 
GeneralRe: Cancel on ThreadPool queued executions? Pin
devvvy11-Oct-10 3:03
devvvy11-Oct-10 3:03 
GeneralRe: Cancel on ThreadPool queued executions? Pin
Luc Pattyn11-Oct-10 3:15
sitebuilderLuc Pattyn11-Oct-10 3:15 
QuestionSeperate conversion functions or 1 overloaded function? Pin
stephen.darling10-Oct-10 3:23
stephen.darling10-Oct-10 3:23 
AnswerRe: Seperate conversion functions or 1 overloaded function? Pin
PIEBALDconsult10-Oct-10 4:18
mvePIEBALDconsult10-Oct-10 4:18 
AnswerRe: Seperate conversion functions or 1 overloaded function? Pin
Abhinav S10-Oct-10 6:04
Abhinav S10-Oct-10 6:04 
GeneralRe: Seperate conversion functions or 1 overloaded function? Pin
stephen.darling10-Oct-10 7:22
stephen.darling10-Oct-10 7:22 
GeneralRe: Seperate conversion functions or 1 overloaded function? [modified] Pin
Not Active10-Oct-10 9:28
mentorNot Active10-Oct-10 9:28 
AnswerRe: Seperate conversion functions or 1 overloaded function? Pin
Eddy Vluggen10-Oct-10 11:34
professionalEddy Vluggen10-Oct-10 11:34 
GeneralRe: Seperate conversion functions or 1 overloaded function? Pin
PIEBALDconsult10-Oct-10 14:14
mvePIEBALDconsult10-Oct-10 14:14 
GeneralRe: Seperate conversion functions or 1 overloaded function? Pin
Eddy Vluggen10-Oct-10 20:37
professionalEddy Vluggen10-Oct-10 20:37 
QuestionRetrieving a DataTable from a Collection by name Pin
boreland10-Oct-10 1:02
boreland10-Oct-10 1:02 
AnswerRe: Retrieving a DataTable from a Collection by name Pin
OriginalGriff10-Oct-10 1:12
mveOriginalGriff10-Oct-10 1:12 

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.