Using an instance of a delegate parameter

Source: Internet
Author: User

Using system;using system.collections.generic;using system.linq;using system.text;/* An instance of the delegate parameter  * 1, Func is a predefined delegate type for LINQ  * 2, Public delegate tr func<tr> (),//tr for return type  * 3, public delegate TR FUNC&LT;T1,TR > (T1 A1);//tr is a type parameter for return type,<t1,tr>, (T1 A1) is a method parameter  */namespace linqfunc{    class program    {        static bool isodd (int x)         {        &NBSP ;   return x% 2 = = 1;       }        static void Main (string[] args)   &N Bsp     {            int[] Array = new int[] {3,2,4,56,6,14,53};            func<int,bool>mtdel=new func<int,bool> (isodd);            var countodd = Array.count (Mtdel);            Console.WriteLine ("The Count of Odd num Bers:{0} ", countodd);          &nbsp Console.readkey ();       }   }

Use an instance of a delegate parameter

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.