strange statement in Settings.Designer

T

Tony Johansson

Hello!

At the end is the complete code for file Settings.Designer.cs

I can't understand this statement
((string)(this["NorthwindConnectionString"]));
in this NorthwindConnectionString propery
public string NorthwindConnectionString
{
get
{
return ((string)(this["NorthwindConnectionString"]));
}
}


namespace WindowsApplication1.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator",
"8.0.0.0")]
internal sealed partial class Settings :
global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance =
((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new
Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}

[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
[global::System.Configuration.DefaultSettingValueAttribute("Data
Source=HEMPC\\SQLEXPRESS;Initial Catalog=Northwind;Integrated
Security=True")]
public string NorthwindConnectionString
{
get
{
return ((string)(this["NorthwindConnectionString"]));
}
}
}
}

//Tony
 
A

Alberto Poblacion

Tony Johansson said:
I can't understand this statement
((string)(this["NorthwindConnectionString"]));

This statement is just calling the indexer "this". Since it is not
defined in the Settings class itself, the version of the indexer that is
called is the one in the base class (ApplicationSettingsBase). If you read
the Framework documentation for ApplicationSettingsBase, you will find the
description for the indexer under the "Item" property: "Gets or sets the
value of the specified application settings property."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top