What is Chinese in Aspx. CS?

Source: Internet
Author: User
In the past, I wrote the Aspx. CS code to display a sentence in Aspx. For example, I found 156 records in total.
I wrote this as follows: This. beforehint. Text = string. Format ("{0} records found in total", num );
In general, there is no problem, but once the text information needs to be modified, the Aspx. CS file needs to be modified, and the system needs to be re-compiled. If it's just a place to modify, there's no big problem. It's just a little hard work, but once there are multiple places to change (How many pages a system has, the number of prompts on each page), but the effort is second, not changed, resulting in inconsistent style, it is not good to scare the children.
Therefore, we should extract this part of information from Aspx. CS and place it in the same place. This facilitates modification and is not prone to errors!
For example: 1/*** // <summary>
2 // public prompt Character Set
3 // provide all the prompts, explanations, and instructions in the program
4 /// </Summary>
5 public class commontext
6 {
7 Private Static commontext = NULL;
8
9 protected commontext (){}
10/*** // <summary>
11 // get an instance of commontext
12 // use Singleton Mode
13 /// </Summary>
14 /// <returns> an instance of commontext </returns>
15 public static commontext getcommontext ()
16 {
17 if (null = commontext)
18 {
19 commontext = new commontext ();
20}
21 return commontext;
22}
23/** // <summary>
24 // query the string of the prompt statement
25 /// </Summary>
26 Public String hint
27 {
28 get
29 {
30 return "A total of {0} records are queried ";
31}
32}
33}

This. beforehint. Text = string. Format (commontext. getcommontext (). Hint, num );
In this way, all the prompts, explanations, and instructions can be managed together.
A better job is to make it into a font!

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.