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)
            {
                lines.Add(line);
                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);

                numbers.Add(convert);
            }

            numbers.Sort();

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

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

C++

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

Development

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

.NET

Linq2Azure - 1.1.0.0 update released

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

1.1.0.0 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
{
Red=1,--&amp;gt;0001
Yellow=2,---&amp;gt;0010
Green=4---&amp;gt;0100
}

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