Sunday, July 25, 2010

Leads by the example of the counter (C #)


Long time not to blog, that is also fun, suddenly feeling in some C # class, why, its constructor is invisible?

And often these classes in a program there is often only one instance. So I did an experiment was as follows:

Leads by the example:
using System;

namespace ConsoleApplication1
(
/ / /
/ / / Class1 in the summary.
/ / /
class Class1
(
/ / /
/ / / Application main entry point.
/ / /

[STAThread]
static void Main (string [] args)
(
/ /
/ / TODO: Add code here to start the application

Class2 c1 = Class2.Init;
Class2 c2 = Class2.Init;
c2.refDis ();

Class3 c3 = new Class3 ();
Class3 c4 = c3;
c4.refDis ();


Class3 c5 = new Class3 ();
c5.refDis ();


Console.ReadLine ();

)

)

class Class2
(
static int ref_2 = 0;
private Class2 ()
(
+ + Ref_2;
)
public static readonly Class2 Init = new Class2 ();
public void refDis ()
(
Console.WriteLine ("Class2 reference:" + ref_2);
)
)
class Class3
(
static int ref_3 = 0;
public Class3 (){++ ref_3;)
public void refDis ()
(
Console.WriteLine ("Class3 reference:" + ref_3);
)
)

)



Output:
Class2 reference: 1
Class3 reference: 1
Class3 reference: 2


Read the above results may surprise you will find some, maybe not, is not it? In many cases, we are trying to

To get an instance of the class how many? Usually think of counter examples of the practice. Yes, with a static variable

Do instance counter is appropriate to the. But also sometimes, we do not want to, too many of our examples

Such as: DataRead it is always only one. So how can we do? I see the above experimental results?

Ah main speaker, found anything? public static readonly Class2 Init = new Class2 ();

Interested in this one is it? Do you have any objection to it? Remove the static right? Well, then, if you like.

Like this: public readonly Class2 Init = new Class2 (); let us see what happens, ah, oh

See the. No way to instantiate to operate. Ha ha. . . Do not worry, let me further explain, static members are

On the static storage area is to be completed early in the program loads configuration. So obviously, Init value, in fact,

In the beginning, the new up an object to it. It holds a reference to the object. Let us look at these two

Class2 c1 = Class2.Init;

Class2 c2 = Class2.Init;

Looks nothing special, is ah, according to the above statement, this is just in passing reference. Therefore, counter examples

Always one, because I said, is in the process of beginning to complete the configuration. So following these lines, is the best

Note:

/ / Pass the new object reference is not instance, so instance of the counter is still 1
Class3 c3 = new Class3 ();
Class3 c4 = c3;
c4.refDis ();

/ / Allocate a new instance of the first, instance of the counter value plus 1. Is 2
Class3 c5 = new Class3 ();
c5.refDis ();







Recommended links:



avchd TO mov



mp4 to Mp3 converter



Games Board Report



3DS MAX examples of lighting and LIGHTING effects



ESRI experts, non-Chan: Snow Emergency GIS can do more



Ultimate Registry Operations - Lock Registry



Q QQ Coins To Pay Part Of Wages Law, Experts Say



Learning Centers: RHCE exam on THE 30 main directions



Guide Computer Education



Tomcat For A Similar Visit To Password IIS



Police identified Results: Foxconn high fall dead before his death, Department staff



In 2010, desktop sales will reach 26.002 million



Converting mp3 to aac



Flash Game Production - Shooting



mkv video Format



Wednesday, July 21, 2010

Bill - Bill Gates retirement after pitching in a number of patent applications



July 15, according to foreign media reports, last week by the Searete company in a patent application submitted by Microsoft founder Bill emerged - the name of Gates, he is working with other team members working on a reduced hurricane power of patents. The patent is the use of equipment to make sea water cooling, to change its surface tension will force the introduction of other security zones, thereby reducing the power of the hurricane.

Searete company's Intellectual Ventures in Bellevue, Washington company's subsidiary company, founded by a former Microsoft executive, is committed to the new invention. Intellectual Ventures founder Nathan - Myhrvold (Nathan Myhrvold) served as Microsoft's chief technology officer, and in 1991 founded Microsoft Research.

Some critics say, Intellectual Ventures will raise the cost of intellectual property litigation, but the company claimed that in addition to universities, laboratories and outside the Fortune 500 companies, also with more than 500 scientists and technical personnel cooperation.

This is not the only one with Bill Searete company - Gates-related patents. Since the Bill - Gates from Microsoft CEO position last year, since leaving office, he will more time and energy on Bill and Melinda Gates Foundation (Bill and Melinda Gates Foundation) on the Fund's objective is to improve global health, education status, poverty reduction, and the maintenance of a number of other benefits.

From the patent application submitted by Searete, we also found that the name of Gates also appears in the magnetic storage engine and patent medicines. Gates, Myhrvold involved with drugs can be controlled temperature storage research and development, the device can maintain the best beer and wine storage temperature. It can be the device's sensors and monitoring equipment, electronic display inside the liquid, without the need to open the device.







Recommended links:



Zune to WMA Gold



Hongtusanbao Devaluation PC MALL Mode



Job interviews when the topic of 15 "Forbidden Zone"



Apen FLAC Ripper



Youtube Video Save + Player SHAREWARE



Best Video to PSP Converter Tools



Science - Screen Savers Directory



convert mpg to MOV



Best Video Format



Youtube Movie To DVD Software



Bluesea CD-R RA CDA To ID3 Ripper



Top Ad Blockers



Youtube to iPod Program



Psp Video Converter



Convert mpeg to avi



Friday, July 2, 2010

Xilisoft Audio Converter

Xilisoft Audio Converter is an all-in-one audio converter. It can extract the audio tracks from AVI,XviD,DivX,MPEG,WMV and ASF and save them as any popular audio formats like MP3,MP4,M4A,WAV,WMA,MP2,VQF,APE,OGG,AAC,FLAC. In addition, the software can convert between MP3,WMA,WAV,MP4,M4A,OGG,MP2,VQF,APE,AAC and FLAC with high ripping speed and friendly interface. The software supports ID3 tag and batch conversion. Users are able to edit the output path or use the same one as the input path or delete the original files. All of settings is easy to use. Xilisoft Audio Converter copys ID3 tag between audio formats (reserve ID3 tag during conversion). When converting to MP3, bit rate,VBR or CBR,stereo or mono are selectable. When converting to WAV,sample rate,stereo or mono and compression method are selectable.

Software Features:
1. Convert AVI, MPEG, WMV, ASF to MP3, WAV, WMA, MP4, M4A, MP2, VQF, APE, OGG, AAC and FLAC;
2. Convert between MP3, WAV, WMA, MP4, M4A, MP2, VQF, APE, OGG, AAC and FLAC;
3. Support batch conversion;
4. Copy ID3 tag between audio formats ( reserve ID3 tag during conversion);
5. When converting to MP3, bitrate, VBR or CBR, stereo or mono are selectable;
6. When converting to WAV, sample rate, stereo or mono and compression method are selectable;
7. Users are able to edit the output path or use the same one as the input path;
8. Allow users to select whether delete the original files.



Recommand Link:



WorldCup DVD Burner



Bluesea SWF to Mobile



PIMS And Calendars Infomation



Professional VOB iPod 3G2 to AVI



ACCOUNTING And Finance brief



Apple MPC APE to CD Convert



Bluesea DVD DAT Maker



Youtube Movie to MOV Pack



Youtube Movie to DAT Software



Youtube Movie to FLV Platinum



f4v to MOV



News ABOUT Audio Recorders



Power 3GP/MP4 Video Converter