tailieunhanh - Professional Microsoft Smartphone Programming phần 2

Fi rẽ tùy chỉnh dự án loại Interop VB6 User Control loại dự án. Loại dự án này cho phép bạn để tạo ra các điều khiển người dùng sau đó có thể được sử dụng để cư trú trong cơ thể của một cửa sổ MDI. Dự án này | .NET Compact Framework Fundamentals In the preceding example two strings are defined. The second one is using the @ form to avoid escaping sequence. Literal strings are stored as UTF-16 Unicode characters on the runtime heap. The CLR ensures that portion of a literal string may be shared by other string objects. As the example shows the easiest way to create a string object is to assign a literal string to the object. The class has a ToString method that any other classes can override to return a string object that provides meaningful information about the underlying object. Another way to associate strings to a string object is to use a string resource which can be added into an Assembly Resource File. Literal strings defined in an Assembly Resource File are saved in UTF-8 code. The .NET Compact Framework provides a namespace for resource file access. The string type supports common string operations such as searching a character or a substring string concatenation comparisons and so on. Note that a string object is not mutable in that the sequence of characters referenced by the string object cannot be modified you can t remove a character from the sequence or append a new character to it. When you use the ToUpper and ToLower methods to switch between lowercase and uppercase respectively the original string is not changed at all instead a new string is generated from the resulting conversion whereas the original string stays intact and can be referenced by other objects or collected as garbage later. You can explicitly let a string object reference another literal string. This design rationale of immutable string objects simplifies multithreading applications that have multiple threads accessing the same string object a read-only object is obviously easy to share. The downside of course is the new string allocation on the runtime heap while references are changed. In the following example first a string object productName is created

TỪ KHÓA LIÊN QUAN