Visual C # 2005 Development Tips

Source: Internet
Author: User
Tags arrays

Visual C # 2005 has some hardening in terms of variable type, generics, and so on, and basically you can subdivide this into the following sections:

To improve the efficiency of program writing, the use of code snippets is a very many programmers use methods, in-depth understanding of the program code snippet will bring you a powerful effect.

Before using a variable, be sure to declare the variable type first. Visual C # 2005 adds a null type to allow variables to be more resilient when processing data, and you must never miss this part if you are working with data that often has null values.

In the logical judgment, in addition to the commonly used if, else, switch, case, do not forget that the keyword is can be used. If you want to know the type-checking judgment, you should never miss this part.

The reference to type conversion cannot be made without mentioning the keyword as. There are three different ways of conversion in the type conversion which are used in the program design, and the relationship between the data type and the independent variable is different.

Calling the Windows API in your application is not a perfect thing, and you should try to avoid some of the serious drawbacks of using the Windows API. In this case, replacing Windows API calls with the. Net Framework category is a good alternative. You should seriously learn how to use namespaces such as Microsoft.Win32, System.Windows.Forms, System.Diagnostics, and System to replace the original Windows API.

Common string handling in applications now has a better approach, and we're going to use a lot of the. Net Framework's string classes to do this. It is difficult to fail the string category whether it is the acquisition of string data, the comparison of strings, the common operations of strings, or the creation of new strings through existing strings.

After learning to use the string category, in order to manipulate strings more efficiently, the StringBuilder category is something you do not know. Proper use of the StringBuilder category can significantly reduce the probability of memory configuration operations, effectively improve performance.

To make the contents of a string richer and more varied, it is necessary to define a composite format for strings and to learn to format string data. Making the best use of them will make your string data more complete and more responsive to your needs.

In addition to string data, dates and times are extremely common. Basically, it is most convenient to use datetime structure and TimeSpan structure to calculate and compare date and time. Therefore, the focus of the topic on date and time is the understanding of both structures.

In Visual C #, variables and arrays are what developers must learn. There are a number of things to watch out for when using arrays, which is useful when you encounter array-related problems. Other common topics such as how to make string and byte arrays bidirectional, object array creation, sorting, binary search, and strongly typed arrays are also described in detail.

For iterative programming, Visual C # 2005 adds iterator operations. Through the yield operator, you can provide the result of the operation to the enumeration value object to represent the iterative operation.

Visual C # 2005 is very much fortified with generics, and these enhancements are very practical.

In fact, the. Net Framework 2.0 itself already contains several interfaces and classes for defining a generic set in the System.Collections.Generic and System.Collections.ObjectModel namespaces, which developers can use directly to establish strongly typed collections, which are more powerful than Non-generic strongly typed collections have better type safety and efficiency. Therefore, understanding the generic collection categories in the. Net Framework 2.0 can be achieved with simplicity.

In Visual C #, playing audio is a very simple thing to do. Using the categories in the System.Media namespace, Visual C # can use simple syntax to access the sound effects provided by the system. If you are interested in accessing audio, you must not miss this section.

In order for the resources of the whole project to be used effectively, it is impossible to understand the method of establishing and accessing project resources. In addition to using the Resource editor, we can Access project resources through program code in the application, which is a very useful technique.

Applications allow the dynamic storage and extraction of property settings and other information, called Application settings. In addition to connecting a property to an application setting through the Settings page of the Project Designer, or through the Properties window of a form or control, you can use the properties and methods of the ApplicationSettingsBase class to access it.

How to borrow Visual Basic's My object in Visual C # to accomplish many of the previously difficult issues in Visual C #.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.