Skip to content

Coding style

BarryThePenguin edited this page Nov 7, 2014 · 11 revisions

Based on Mono Coding Guidelines

Use VS Settings Switcher in Visual Studio along with SparkleShare.vssettings to automatically adhere to coding style

// License text
// and copyright
//
// Use spaces, not tabs


using System;
using System.Diagnostics;
using System.IO;
using System.NyanCats;
using System.Threading;
using System.Unicorns;

namespace SparkleShare {

    public class CodingStyle {
        
        public string [] NyanCats { get; private set; }
        public NyanCats cats;
        
        private int number_of_unicorns;
        private double rainbow;
        
        public string Text {
            get {
                 return "a" + "b" + "c";
            }
        }


        public CodingStyle ()
        {
            NyanCats                = new NyanCats [3];
            this.number_of_unicorns = 42;
            
            NyanCats [0] = new NyanCat ();
            NyanCats [1] = new NyanCat ();
            NyanCats [2] = new NyanCat ();
            
            Sparkle ();
            Thread.Sleep (5);
            
            cats [0].Meows += delegate {
                this.number_of_unicorns++;
            };
        }


        private void Sparkle (NyanCat cat, bool repeat)
        {
            while (repeat) {
                Unicorn pink_unicorn = new Unicorn () {
                    HasWings     = false,
                    Farts        = true,
                    FriendOnBack = cat 
                };
                
                try {
                    if (unicorn.)
                        unicorn.Fly ();
                    else
                        unicorn.Fart ();
                    
                    if (unicorn.HasWings) {
                        unicorn.Fart ();
                        unicorn.Fly ();
                    
                    } else {
                        unicorn.Fart ();
                        Sparkle ();
                    }
                    
                    unicorn.Jump ();
                    
                } catch (FriendFellOffException e) {
                    Console.WriteLine (e.Friend.Name + " fell off!");
                    break;
                }
            }
        }
    }
}