Tags » C#

[EASY] Simple Sorting - CodeEval

Here is the problem: https://www.codeeval.com/open_challenges/91/

And here is my solution. I get 100% with this code.

using System;
using System.IO;
using System.Collections.Generic;
using System.Globalization;

class Program
    static void Main(string[] args)
        StreamReader reader = new StreamReader(args[0]);
        List<string> lines = new List<string>();
        List<double> numbers = new List<double>();
        char[] separator = new char[] { ' ' };

        using (reader)
            string line = reader.ReadLine();

            while (line != null)
                line = reader.ReadLine();

        for (int i = 0; i < lines.Count; i++)
            string[] numbersFromLine = lines[i].Split(separator, StringSplitOptions.RemoveEmptyEntries);

            for (int j = 0; j < numbersFromLine.Length; j++)
                double convert = Convert.ToDouble(numbersFromLine[j], CultureInfo.InvariantCulture.NumberFormat);



            foreach (var number in numbers)
                Console.Write("{0:F3} ", number);            }
            numbers = new List<double>();

Copy constructor madness

Hi everyone!

Me again and a new portion of c++ madness. This is fairly basic stuff, but a lot of people tend to not know it. 647 more words


Nancy Testing - Razor View with Referenced Models

The last few weeks I’ve been working with Nancy (an awesome web framework for .Net), the core goal of the framework is the super-duper-happy path: 691 more words


How to check if SharePoint List exists in SharePoint 2010 and 2013 (PowerShell and C#).

The following code snippets will show an example of how to use the TryGetList of the SharePoint Object Model. The TryGetList() method will either return the list object itself, or ‘null’ if nothing is found – rather than throwing an exception! 75 more words


Linq2Azure - update released

It has been a while since a release, so this is a relatively big one. Release Notes:

  • Added basic support for Storage Accounts.
  • Added support for Reimage/Rebuild Role Instance.
  • 65 more words

#2:Enum With Flags

Enum can take Flags as attribute and perform bit operations over the numerics(Values must be power of two).

public enum Color

var combination = Color.Red | Color.Green;
Console.WriteLine(combination); /* Red,Green*/
… 18 more words