Where to use static constructor and static class

dear friends
    Can you tell me in which scenario we have to use static class and
static constructor?

Thanks in advance
0
Ashok
5/27/2010 12:55:50 PM
dotnet.languages.csharp 1931 articles. 0 followers. Follow

1 Replies
744 Views

Similar Articles

[PageSpeed] 27

Ashok kumar wrote:
> dear friends
>     Can you tell me in which scenario we have to use static class and
> static constructor?

Use a static class when you want to implement functionality that does 
not require per-instance state (i.e. all consumers of the class can 
share the state).

Use a static constructor when you need to initialize state in a class 
that is shared by all consumers of the class.

Pete
0
Peter
5/27/2010 3:17:42 PM
Reply:

Similar Artilces:

Unable to go online when using a router
Hi I have several CRM laptop users who are unable to go online while at home. They are able to get a functioning VPN connection and ping the servers but when trying to go online with CRM they get the Unable to connected to the CRM server error. However the same users are able to go online when using a vodafone card. I am guessing the problem is with the routers that are being used at their homes Has anyone got any idea how to rectifty this ? Thanks Brian Is your network set up where they cannot access the SQL Server directly when they come in on the VPN? Simple test from a command ...

where to purchase visio 2003 for use with windows 98 SE
I am using windows 98 SE and would like to install visio. When I went to comp usa, staples, etc. I was shocked to find that visio 2003 can only be used with win 2000/xp. Can anyone suggest a legitimate source where i could buy a new, unused copy of visio 2002 for use with win 98 and what a reasonable price is? Also, to qualify for the cheaper 'upgrade' version, what apps must already be installed? What are the requirements for the full, non-upgrade version, which will probably be about twice the price? thanks. ...

Text File using MACRO
Hello, I will appreciate if someone assist me in order to solve the following problem. I want to read an operating system file from EXCEL sheet. The information in this text file appended each day. That’s why I want to use Macro to read this text file which is located on c:\SEDAN\INFO\Mit.log. What steps should I follow in order to read this text file using MACRO. Each time when I run the MACRO it refreshes the information from the text file and display its information into Excel sheet. Could you please check that matter and give me its solution? Regards David. Start a new workb...

How to put limits on frame resizing when using splitter window?
Hi, I have a static splitter window in SDI. The right pane of the splitter is a CScrollView. The main frame is resizable. How do I prevent a user from resizing the frame so the right pane does not go beyond a given size?. The left pane's size is not important. I keep the frame size in check on splitter bar drag by calling ResizeParentToFit(TRUE) . Thanks, Bogdan As far as I know, you will have to override the WM_MOUSEMOVE message and do your limiting there. Basically what you will have to do is copy the content of CSplitterWnd::OnMouseMove into your CSplitterWnd::OnMouseMove ...

which free e-mail clients are available to use with outlook 2003?
I have just found out that yahoo isn't compatible with outlook 2003 for some reason, and that Hotmail services will only work if they are the premium services. Is there any other e-mail client available to use with this edition of outlook? Many Thanks GMail seems to support Outlook 2003: http://gmail.google.com/support/bin/answer.py?answer=13278 "gemma" <gemma@discussions.microsoft.com> wrote in message news:3D9B32DA-EF1D-4611-BE4D-D4101580D4FF@microsoft.com... >I have just found out that yahoo isn't compatible with outlook 2003 for >some > reason, and ...

Using an update query to update amount in stock automatically
I have created a database to keep a track of orders. In the stock table I have a field called amount in stock. In order table I have a field called order quantity. I have created an update query to update amount in stock to [amount in stock]-[order quantity]. I wish to create a macro to run the update query on my order form once the sale is confirmed. My problem is that I want to just update the single record on the order form, and not all items of stock from all existing orders. I know I can add a parameter criteria to my update query (i.e. enter order number) so that only stock relating ...

Reporting options for emails blocked using DNSBL or as unknown recipient
In our Exchange configuration I have recently made two changes: 1. To block emails from being received for unknown recipients (as per KB 886208) 2. To block senders using a DNS block-list. Both of these were implemented as anti-spam measures and both of these seem to be working fine. What I am curious about is whether there is any logging I can turn on which will give me an indication of how many emails each of these methods is blocking. Any ideas appreciated. -- Brian Cryer www.cryer.co.uk/brian Perfmon counters are available for these. However, these are reset every time Exchan...

Use of CFileDialog
I'm trying to use CFileDialog to allow the user to select an existing file, but it asserts in DoModal because (m_ofn.Flags & OFN_ENABLEHOOK) is ok. If I set that flag, it'll assert because (m_ofn.lpfnHook != NULL) is false. I didn't think I needed to provide a hook function. If I do, how should I provide it and what should it do? If I bypass those two asserts, the dialog comes up but displays no files. Have I created the filter string incorrectly? Finally, it dies with an access violation in the destructor. I'm guessing this will stop if I fix the other two issues. I'...

Help! on filtering a report using a form & query
Hi. I've got a database with lookup fields. I have a form, a query and a report whose record source is the query. I want the user to select the lookup field from a drop down combo box And then run the query. If I change the query so the the criteria reads: [Forms]![frmCloseOutFilter]![txtCollection] and then run it, it will prompt me for the collection, I type a "3" and I get the desired results. It also works If I then run the report separately. But, If I try to run it from the form, I select my collection (It's a two column combo box, the first column has a width of 0...

searching records that use a range for Values
I am trying to figure out the best way to set up tables that have value ranges. This is to be used for entering Plant Information. Heights,etc are typically expressed in ranges, i.e. 10-12', 12-14', 14-16' etc. Sometimes it might be necessary to create an entry where heights are 10-16'. I thought about using 2 fields for each record; "min height" & "max height". I'm concerned about how I would eventually construct a query to search for ranges if this is the proper thing to do. I am not a programmer (I don't know VBA) and do this in my spare tim...

Wrapped classes from ActiveX
How I can make source code from activeX components (with all properities,methods etc) in Visual Net 2002 or higher ?? In Visual C++ 6.0 they were generated by environment. Visual Net 2002 generate only headers for ActiveX components (without methods and properities) I tried with MSFlexgrid 6.0, MSDataGrid and ADODC controls -- Darth Marhev ...

how do you use html
does anyone know how to use html? "admin@cybererrol.co.uk" <admin@cybererrol.co.uk@discussions.microsoft.com> wrote in message news:D9833D80-F4BA-4221-8211-EEE3B68C1666@microsoft.com... > does anyone know how to use html? Yes. *Some* of the people who write websites do. (Just in case you did not know, this group is for discussing Microsoft Access, the desktop database.) -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. On Tue, 11 Mar 2008 07:27:...

How to use same formula throughout the spreadsheet??
I would like to use the same formula throughout the spreadsheet, although the cell numbers and values will be different. For example =b1-SUM(c1:f1). How do I format it so this calculation takes place for each row of cells but with their respective cell numbers and values? Hi i'm assuming that you've got the formula say in A1 and you want it in A2, A3 ..... to do this, click on the cell with the formula move your mouse over the bottom right hand corner of the cell and you'll see a little + double click on the + this should copy the formula down as far as there is data in ...

using Control to populate combobox
Dear, I have a form where i have to populate diferent comboboxes at diferent stages with data from a seperate database. Im trying to write a Function that would easally repeate the task, the main problem is specifeing what combobox to use. here is a part of my coding Public Sub LoadCB(cbName As Control, SelectionString As String) cbCount = 0 Set rstLoadCB = VMSDatabase.OpenRecordset(SelectionString) With rstLoadCB .MoveLast cbCount = .Counter .MoveFirst If TypeName(CB) = cbName Then End If Next CB End With Set rstLoadCB = Nothing...

How can I use a worksheet to plot polar coordinates?
I am trying to use an Excel worksheet as the matrix for plotting polar coordinates. Is there a way that this can be done? Hi, Have a look at these web pages on the subject. http://www.oaltd.co.uk/Excel/SBXLPage.asp#Charting http://www.stfx.ca/people/bliengme/ExcelTips/Polar.htm http://www.andypope.info/charts/polarplot.htm Cheers Andy louradam wrote: > I am trying to use an Excel worksheet as the matrix for plotting polar > coordinates. Is there a way that this can be done? -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info ...

Cannot connect to Vanguard using Online Services
I cannot connect to the Vanguard Group with Money 2005 eventhough Vanguard and money say I should be able to. It says the connection failed. I can connect to my other banks. There is no descriptive error message. Anyone know why this is? Well, I CAN connect to Vanguard but CANNOT connect to Hewitt Assciates LLC, another brokerage. MM 05 is buggiest Microsoft product I've ever seen. In microsoft.public.money, MelTracy wrote: >I cannot connect to the Vanguard Group with Money 2005 eventhough Vanguard >and money say I should be able to. It says the connection failed. I can...

Using Outlook meeting reminder as event registrant follow-up
Hi all, Has anyone used the Outlook meeting reminder as a follow-up to registrants of a seminar/webinar or other event? If so, how do you set-it up for bulk distribution without the recipients seeing the other attendees? Any advice would be helpful. ...

Using Outlook and Hotmail together
Someone told me that it is possible to set up your outlook account to work through the hotmail server, so that you can utilize the features of outlook without having to have (and give) access to your secure server. Is this true? If so, are there any special tricks to getting it done? Any info would help me and thousands of students who aren't able to learn Outlook in courses because of server issues!! Thanks! There is a way and it is very easy! This will work with Outlook 2002 and I think 2000 also. Go to Tools > Email Accounts > Add new email account > Select HTTP >...

Evaluate formula using VBA
How can I write a VBA code to evaluate this formula Y = alpha*EXP(-alpha*(X-U)-EXP(-alpha(X-U))) ...

how do i use excel to refer to outlook?
I'm trying to pull contact information and other information from outlook and use in excel Try File-->Import and Export from Outlook. ************ Anne Troy www.OfficeArticles.com "chip_pyp" <chip_pyp@discussions.microsoft.com> wrote in message news:14CF4B2D-A361-4FA6-B41A-D965EA40D8BB@microsoft.com... > I'm trying to pull contact information and other information from outlook > and > use in excel ...

C++ Structure using Windows Messages.
Hi guys, Is there any way to send structure using windows Messages. I know we can use WM_COPYDATA message to send the information to the other application.But i donot want to use that. Iam creating a user defined message using RegisterWindowMessage.I want other applications to use this message in order to read the structure. Iam using HWND_BROADCAST to send the structure.Is there any way i can do this. thanks in advance, Sada sada wrote: > Hi , > That was an excellant idea.But one more question ( :) ) .Wouldn't their > be any other application affected by sending WM_COP...

HR Benefits
Hi all, We have a client that is in process of implementing HR (but not w/ Payroll). We are working on the setup for Benefits and have the issue of Copays and other coverage are stated in terms of % covered or % coninsurance (so employee pays some % of the medical expense instead of a standard co-pay or deductible). Is there someone out there that can recommend how to put this in Great Plains? I was thinking that we could just put in $0.80 when it's 80% covered or $0.50 for 50% coinsurance. They do not have extender, so that is not an option. Any ideas would be helpful. Tha...

Using TLS index hangs my app.
Hi, I've a function run by a thread (the thread is created with this function) with many returns. I decided to use some kind of "Resource Acquisition Is Initialization" and register every resource in a class that would liberate them once the function exits (i.e. the threads ends). But when i register TLS index, my application hangs in MSVCRT.dll with an exception violation. The code is like follows: UINT CConexion::HiloCliente( LPVOID pParam ) { /*local object to liberate resources*/ CRAII raii(pConexion, socketAtado->ptr); /*register resources*/ CIndice * ...

Static Header Row
How do I make the top row of a spreadsheet a "nn-scrolling" header row? Many thanks. Andrew, select A2 and then window, freeze panes -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Andrew Chalk" <achalk@magnacartasoftware.com> wrote in message news:%23IopK$AAGHA.2256@TK2MSFTNGP11.phx.gbl... > How do I make the top row of a spreadsheet a "nn-scrolling" header row? > > Many thanks. >...

Tab Ctrl using buttons instead of tabs
Hi, I am using a tab control and have implemented buttons instead of the normal tabs. My problem is that, on the first button press, the button selected does not get depressed visually, but the act of pushing the button gets handled and the new dialog is displayed. This only happens on the first button press, subsequent presses are fine. It does not happen when buttons are replaced with tabs. Does anyone know how I can force the buttons to keep up t odate on the first press? TIA Tony Are you creating buttons as 'PushButtons'? How are you setting the initial state of the...