Click here to Skip to main content
15,891,136 members
Articles / Programming Languages / C# 4.0

How does it work in C#? - Part 2

Rate me:
Please Sign up or sign in to vote.
4.81/5 (42 votes)
4 Feb 2013CPOL7 min read 104.1K   1.8K   150  
How does throw, rethrow and where, select clause of Enumerable class work in C# programming language.
namespace TestHarness
{
    using System;
    using System.Linq;

    class Program
    {
        static void Main(string[] args)
        {
            AutoImplementatedPropertiesTest();
            EventDelegateTest();
            Console.ReadLine();
        }

        private static void EventDelegateTest()
        {
            Console.WriteLine("\n2)Event and Delegate += Test:");
            AddRemoveHandlerOfEvent addRemoveHandlerOfEvent = new AddRemoveHandlerOfEvent();
            LogIt logItObject = addRemoveHandlerOfEvent.InitialiseLogIt();
            addRemoveHandlerOfEvent.GetInitialMethodPointer().ToList().ForEach(item => Console.WriteLine(item));
            addRemoveHandlerOfEvent.GetInvocationListFrom(logItObject).ToList().ForEach(item => Console.WriteLine(item));
        }

        private static void AutoImplementatedPropertiesTest()
        {
            Console.WriteLine("1) AutoImplementatedProperties Test:");
            AutoImplementatedProperties autoImplementatedProperties = new AutoImplementatedProperties();
            Person person = autoImplementatedProperties.CreateATestObject();
            Console.WriteLine("[] Explore all the members...\n");
            autoImplementatedProperties.ExploreMembers(person).ToList<string>().ForEach(item => Console.WriteLine(item));
            Console.WriteLine("[] Explore all the private fields...\n");
            autoImplementatedProperties.ExplorePrivateFields(person).ToList<string>().ForEach(item => Console.WriteLine(item));
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Australia Australia

Comments and Discussions