Sunday, May 08, 2005

Instance Constructor vs. The Class Constructor

Instance Constructor vs. The Class Constructor

A good explanation of difference between the instance constructors and the class constructors.

Class constructors are used for static field initialization. Only one class constructor per type is permitted, and it cannot use the vararg (variable argument) calling convention. Normally, class constructors are never called from the IL code. If a type has a class constructor, this constructor is executed automatically after the type is loaded. However, a class constructor, like any other static method, can be called explicitly. As a result of such a call, the global fields of the type are reset to their initial values. Calling class constructor explicitly does not lead to type reloading.

MS Access Application With C#

MS Access Application With C#


I encountered this problem when I wrote the map projection function for the DTMap, since I need to get some data from the EPSG_v66.mdb and write it to the xml file. I think this is a good start.

Thursday, May 05, 2005

Waiting for the I-140 aproval.

Waiting for the I-140 approval is one of the most painful thing in my life, the response to the RFE has been submitted last week, and USCIS records shows that they have received the response on Apr 26. Then in the following three days, 27, 28, 29, the LUD keeps change, so I guess that somebody is working on my case. However, after that, nothing happens. Well, this is also normal, accoridng to the pattern observerd on the immigration.com, a lot of people have the similar experience.

Hopefully, I will have it approved by next week.

God bless me!

Monday, May 02, 2005

Split a string by double pipe.

How to split a string like "TEST1||TEST2".

I raised this question in C# MS newsgroup, and Tim Wilson answered my question that I should use

string[] asTest = Regex.Split(sTest, @"\|\|");

Well, this works beautifully. But it takes ome time for me to fully understand it. Fristly of all, "|" is considered one of the special characters (. $ ^ { [ ( | ) * + ? \) in the regular expression , so \ signals to the regular expression parser that the character following the backslash is not an operator. Then, how about string[] asTest = Regex.Split(sTest, "\|\|"), The compiler complains error CS1009: Unrecognized escape sequence. Will it make sense? According to MSDN , it means that "An unexpected character followed a backslash (\) in a string. The compiler expects one of the valid escape characters", then what is valid escape characters, | is a NOT a valid character following \, by using @ , we mean \| Unicode character 007C, do you understand, I am NOT.