Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

strange statement in Settings.Designer

0 views
Skip to first unread message

Tony Johansson

unread,
Nov 20, 2009, 8:21:36 AM11/20/09
to
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


Alberto Poblacion

unread,
Nov 20, 2009, 8:45:45 AM11/20/09
to
"Tony Johansson" <johansson...@telia.com> wrote in message
news:AJwNm.12915$U5.1...@newsb.telia.net...

> 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."

0 new messages