Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
| Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 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
  #1 (permalink)  
Old December 20th, 2003, 07:27 AM
Authorized User
 
Join Date: Sep 2003
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default Static Constructors

Hi Again!!

I have just found that static constructors can not specify access modifiers... I was wondering why....

somebody please explain...!!

much appreciated.......

Ibn_aziz
  #2 (permalink)  
Old December 20th, 2003, 05:21 PM
Registered User
 
Join Date: Dec 2003
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How are you using it in your code?

Is this an error message you got?

  #3 (permalink)  
Old December 21st, 2003, 10:43 AM
Authorized User
 
Join Date: Sep 2003
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Actually... I got this from one of the CSharp books........
It states that because static constructors are automatically private...... no other access modifiers may be specified.. including private.....

but I was just wondering why they were automatically private... I can't seem to find the link!!
  #4 (permalink)  
Old December 25th, 2003, 04:07 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

Specifying an access modifier for a static constructor would be meaningless as it is never called by any kind of C# code that you write to make use of the class, instead they are called by the .Net Environment as the class definition is loaded for the first time in the program.

Ankur Verma
.Net and C++ Specialist
Wiley Tech Support


Similar Threads
Thread Thread Starter Forum Replies Last Post
Constructors madhuriguda C# 2 April 29th, 2008 08:11 AM
Constructors - instantiation brysora C# 2005 1 September 3rd, 2007 08:45 PM
non-static reports to static html files miamikk ASP.NET 2.0 Basics 0 June 4th, 2007 01:48 PM
Cascading Constructors rodmcleay General .NET 4 May 18th, 2007 03:57 AM
COPY CONSTRUCTORS gbilios C++ Programming 4 April 30th, 2004 02:51 AM





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