Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 13th, 2009, 03:47 PM
Authorized User
 
Join Date: Dec 2008
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Learning from code

TBH has this code in the globals.cs file:

using System;
using System.Data;
using System.Configuration;
using System.Web.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace MB.TheBeerHouse
{
publicstaticclassGlobals
{
publicreadonlystaticTheBeerHouseSection Settings = (TheBeerHouseSection)WebConfigurationManager.GetSection("theBeerHouse");
publicstaticstring ThemesSelectorID = "";
static Globals()
{

}
}
}

why is the static Globals() there? What does it do?

Thanks,
 
Old March 13th, 2009, 05:26 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

It is an empty (default) constructor.

When there are are no other constructors in a class, as in this case, C# assumes a default one automatically. This means you could remove the static Globals() { } with no effect.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}

Last edited by Lee Dumond; March 13th, 2009 at 05:27 PM.. Reason: punctuation
 
Old March 14th, 2009, 04:12 PM
Authorized User
 
Join Date: Dec 2008
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Lee Dumond View Post
It is an empty (default) constructor.

When there are are no other constructors in a class, as in this case, C# assumes a default one automatically. This means you could remove the static Globals() { } with no effect.
Thanks, got it.

Shawn





Similar Threads
Thread Thread Starter Forum Replies Last Post
E-learning dineshv Flash (all versions) 1 January 4th, 2007 01:35 AM
Learning path sunrain XSLT 5 November 4th, 2006 11:23 AM
Learning C# Jael C# 1 October 19th, 2005 07:54 PM
E-Learning dineshv Flash (all versions) 1 April 1st, 2005 03:12 PM
i am learning kuehhc Beginning PHP 4 March 29th, 2004 04:33 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.