Click here to Skip to main content
15,885,216 members
Articles / Programming Languages / C#

AFP: Almost Functional Programming in C#: Part 2

Rate me:
Please Sign up or sign in to vote.
4.89/5 (4 votes)
6 Mar 2013CPOL20 min read 17.5K   142   12  
Putting the programming style to the test by using it in a multi-threaded server.
using System;
using System.Collections.Generic;

namespace StockTest
{
    public sealed class GlobalState
    {
        public readonly XmlConfig Config;
        public readonly Dictionary<string, Subscription> SubscriptionHash;
        public readonly Dictionary<string, Portfolio> PortfolioHash;

        public GlobalState(XmlConfig config, Dictionary<string, Subscription> subscriptionHash, Dictionary<string, Portfolio> portfolioHash)
        {
            if (config == null) throw new ArgumentNullException("config");
            if (subscriptionHash == null) throw new ArgumentNullException("subscriptionHash");
            if (portfolioHash == null) throw new ArgumentNullException("portfolioHash");

            Config = config;
            SubscriptionHash = subscriptionHash;
            PortfolioHash = portfolioHash;
        }
    }
}

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 (Senior)
New Zealand New Zealand
I am a senior software developer with almost 20 years of experience. I have extensive knowledge of C#, C++ and Assembly languages, working mainly on Windows and embedded systems. Outside of work I am interested in a wider variety of technologies, including learning 20 programming languages, developing Linux kernel drivers or advocating Functional Programming recently.

Comments and Discussions