The tostring method is probably the most used method when it is. net. All types, references, and values all inherit the glorious tradition from the ancestor object. A tostring call is equivalent to an amazing click. This guy is all done.
But writeProgramSuch as case investigation, there are all kinds of people. For those with poor memory and slow response, this is not so smooth. Mei (MEI) is one of them. Let's have a look at it:
Static void testenumtostring () {var day = dayofweek. wednesday; string value = NULL; For (INT I = 0; I <1000000; I ++) {value = Day. tostring ();} console. writeline (value );}
Sort out the results:
Times |
1 |
2 |
3 |
4 |
MS time) |
7135 |
7009 |
7174 |
7010 |
It seems that there is nothing, but it seems a bit tricky according to the previous cases of the Government. In the attitude of being responsible to the people, do not be afraid of troubles. Find another breakthrough:
Static void testenumtostring2 () {var day = dayofweek. wednesday; string value = NULL; For (INT I = 0; I <1000000; I ++) {Switch (day) {Case dayofweek. friday: value = "Friday"; break; Case dayofweek. monday: value = "Monday"; break; Case dayofweek. saturday: value = "Saturday"; break; Case dayofweek. sunday: value = "Sunday"; break; Case dayofweek. thursday: value = "Thursday"; break; Case dayofweek. tuesday: value = "Tuesday"; break; Case dayofweek. wednesday: value = "Wednesday"; break; default: break;} console. writeline (value );}
When you present your certificate, you will be surprised:
Times |
1 |
2 |
3 |
4 |
MS time) |
2 |
1 |
1 |
1 |
I am furious, "bold madman, not from the real recruitment, or else rest blame the government penalty to serve". Where can Mei tell a man to see this situation, all trembling, his head squatting, and then no sound, after a while, yundun was stunned.
"Adults, do you need cold water to wake up and use punishment?" I thought, looking at the merits of the criminal offense, I couldn't help it, and said, "first go to the criminal's home and search for evidence ". The competent catcher, reflector, took the lead and found the clue:
Public override string tostring () {return internalformat (runtimetype) base. getType (), this. getvalue ();} Private Static string internalformat (runtimetype et, object Value) {If (ET. isdefined (typeof (flagsattried), false) {return internalflagsformat (ET, value);} string name = getname (ET, value); If (name = NULL) {return value. tostring ();} return name ;}
Indeed, as expected, the case has been reflected with no scrubs, and the truth of the case is generally clear. For example, isdefined and getname are two parts of the log.
It is a pity that many people in the world are still stuck in the dark, without knowing it, the harm of the virus is very far-reaching. The road to Qingyuan is long. The power of his government is far from enough. I hope that, together with the people with lofty ideals in the world, we will promote good deeds and evil, which will bring peace to life.
Times |
1 |
2 |
3 |
4 |
Fill method (Same as last time) |
309 |
291 |
292 |
292 |
fillparallel method |
210 |
166 |
165 |
166 |