public static void Main()
        {
            /* Enable debug messages. */
            //Debug.Listeners.Add(new TextWriterTraceListener(System.Console.Out));

            String taskName = "org.gridgain.examples.task.CharCountTask";
            String taskArg  = "Hello Dot Net World";

            IGridClient client = CreateClient();

            try
            {
                // Show grid topology.
                X.WriteLine(">>> Client created, current grid topology: " + ToString(client.Compute().Nodes()));

                IGridClientCompute prj = client.Compute();

                // Execute test task that will count total number of nodes in grid.
                int wordCnt = prj.Execute <int>(taskName, taskArg);

                X.WriteLine(">>> Task result [args='" + taskArg + "', wordCnt=" + wordCnt + ']');
            }
            catch (GridClientException e)
            {
                Console.WriteLine("Unexpected grid client exception happens: {0}", e);
            }
            finally
            {
                GridClientFactory.StopAll();
            }
        }
        /**
         * <summary>
         * This method will create a client with default configuration. Note that this method expects that
         * first node will bind rest binary protocol on default port.</summary>
         *
         * <returns>Client instance.</returns>
         * <exception cref="GridClientException">If client could not be created.</exception>
         */
        private static IGridClient CreateClient()
        {
            var cacheCfg = new GridClientDataConfiguration();

            // Set remote cache name.
            cacheCfg.Name = "partitioned";

            // Set client partitioned affinity for this cache.
            cacheCfg.Affinity = new GridClientPartitionAffinity();

            var cfg = new GridClientConfiguration();

            cfg.DataConfigurations.Add(cacheCfg);

            cfg.Credentials = "good.user:password";

            // Point client to a local node. Note that this server is only used
            // for initial connection. After having established initial connection
            // client will make decisions which grid node to use based on collocation
            // with key affinity or load balancing.
            cfg.Servers.Add(ServerAddress + ':' + GridClientConfiguration.DefaultTcpPort);

            return(GridClientFactory.Start(cfg));
        }