The method "Int32 ToInt32 (System. String)

Source: Internet
Author: User

If (! String. isNullOrEmpty (Year) {// The first method var y = Convert. toInt32 (Year); pInfo = pInfo. where (p => p. startTenderDate_T.Value.Year = y); // The second method is pInfo = pInfo. where (p => p. startTenderDate_T.Value.Year = Convert. toInt32 (Year ));} both methods aim to filter data with the date of Year, but the first method can recognize the data. The second method cannot be identified. (The method "Int32 ToInt32 (system. string) error. The reason is that the convert method cannot be recognized in the second linq expression. because the where clause cannot call C # methods such as convert, or add the int type to tostring or put it in the where clause, because it needs to parse the lamda expression rather than parse C # to understand this, you must have a deep understanding of lambda expression parsing.

Related Article

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.