C # common knowledge

Source: Internet
Author: User

1. Use session in a non-system. Web. UI. Page class

Object islogined = system. Web. httpcontext. Current. session ["islogined"];
If (islogined! = NULL)
{
}

2. Store a small amount of data in viewstate

Private int channelid
{
Get
{
If (webutils. getqueryint ("channelid", 0)> 0)
Viewstate ["channelid"] = webutils. getqueryint ("channelid", 0 );
Return utils. strtoint (viewstate ["channelid"], 1 );
}
Set
{
Viewstate ["channelid"] = value;
}
}

 

3. filter data in Dataset

Public dataset getpassedlist ()
{
Return this. getdataset ("[ispassed] = 1 order by [guestid] DESC ");
}

Filter in Dataset
 

Public dataset getpassedlist ()
{
Return this. getdataset ("[ispassed] = 1 order by [guestid] DESC ");
}

4. RMB format:

Decimal price;
Decimal discount;
Decimal discounted_price;

// Compute discounted price
Price = 19.95 m;
Discount = 0.15 m; // discount rate is 15%

Discounted_price = Price-(price * discount );

console. writeline ("discounted price: {0: c}", discounted_price);

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.