One line Program C# version

thanks to dr_spitfire for the idea

Page 1 of 1

7 Replies - 2033 Views - Last Post: 10 January 2010 - 06:35 PM

#1 [email protected]   User is offline

  • JMP *0x0(%RIP)
  • member icon

Reputation: 37
  • View blog
  • Posts: 1,019
  • Joined: 20-February 09

One line Program C# version

Posted 24 December 2009 - 04:44 PM

i would like to thank dr_spitfire for the idea of this and the rules are the same but this is in C#
here are the original rules

View Postdr_spitfire, on 9 Sep, 2009 - 11:32 AM, said:

anyways here's the rules of the game...

Every post you can add one line.

What counts as a single line:
Assigning or manipulating a value to a variable ("int thisVariable;" doesn't count "int thisVariable=1;" does as does "thisVariable++;")
Making a function... return line comes free with non-voids ("float ThisFunction(param 1,param 2){ float param3; return param3;}" would work)
making a loop (including all 3 parts of the for loop) you can either put this around existing code, or leave it empty for someone else to put something in
an if statement! (just like a loop leave it empty or surround existing code)
any input output calculation etc. simple lines...
a void function call...
Define
if I forgot something ask and I'll make a judgement call...

you can add any includes you need free of charge... your program with the new line MUST compile
you can add your line anywhere in the code if it will still compile you are allowed to comment your line so people will understand it... (or more likely just to mess with people)

no removing or changing someone else's lines unless it won't compile as they wrote it.

the rules are the same just the code is just adapted to C#
Have Fun!!!!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Program
{
	 class Program
	 {
			static void Main(string[] args)
			{
			 
			}
	 }
}




Replies To: One line Program C# version

#2 OliveOyl3471   User is offline

  • Everybody's crazy but me!
  • member icon

Reputation: 135
  • View blog
  • Posts: 6,581
  • Joined: 11-July 07

Re: One line Program C# version

Posted 27 December 2009 - 07:22 PM

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Program
{
	 class Program
	 {
			static void Main(string[] args)
			{
			   Console.WriteLine("OliveOyl rocks!");
			}
	 }
}



I like C#, but don't remember a lot of it...will have to go and look some things up in order to keep playing. :)

#3 Choscura   User is offline

  • D.I.C Lover


Reputation: 478
  • View blog
  • Posts: 2,267
  • Joined: 18-October 08

Re: One line Program C# version

Posted 28 December 2009 - 06:21 AM

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Program
{
	 class Program
	 {
			static void Main(string[] args)
			{
			   Console.WriteLine("OliveOyl rocks!");
			   public const int tickertocker= 24;
			}
	 }
}


#4 [email protected]   User is offline

  • JMP *0x0(%RIP)
  • member icon

Reputation: 37
  • View blog
  • Posts: 1,019
  • Joined: 20-February 09

Re: One line Program C# version

Posted 29 December 2009 - 08:54 AM

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;//ya its a comment but its on the same line :P/>
namespace Program
{
	 class Program
	 {
			static void Main(string[] args)
			{
			   Console.WriteLine("OliveOyl rocks!");
			   public const int tickertocker= 24;
			}
	 }
}

This post has been edited by [email protected]: 29 December 2009 - 08:54 AM


#5 5thWall   User is offline

  • Occasional Member

Reputation: 31
  • View blog
  • Posts: 530
  • Joined: 17-September 08

Re: One line Program C# version

Posted 29 December 2009 - 09:59 AM

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;//ya its a comment but its on the same line tongue.gif
namespace Program
{
         class Program
         {
                        static void Main(string[] args)
                        {
                           Console.WriteLine("OliveOyl rocks!");
                           public const int tickertocker= 24;
                           //One line if-statements are made of awesome.
                           Console.WriteLine( (tickertocker % 5 == 0) ? "The time is a multiple of 5!" : "The time is not a multiple of 5!");
                        }
         }
}


#6 borninlyoko   User is offline

  • D.I.C Regular
  • member icon

Reputation: 7
  • View blog
  • Posts: 350
  • Joined: 03-December 09

Re: One line Program C# version

Posted 10 January 2010 - 06:07 PM

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;//ya its a comment but its on the same line tongue.gif
namespace Program
{
         class Program
         {
                        static void Main(string[] args)
                        {
                           Console.WriteLine("OliveOyl rocks!");
                           public const int tickertocker= 24;
                           //One line if-statements are made of awesome.
                           Console.WriteLine( (tickertocker % 5 == 0) ? "The time is a multiple of 5!" : "The time is not a multiple of 5!");
                           Console.WritelINE("Wow, we're definitely nerds... WE'RE AWESOME!");
                        }
         }
}


#7 plasma-hand   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 80
  • Joined: 02-January 10

Re: One line Program C# version

Posted 10 January 2010 - 06:18 PM

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;//ya its a comment but its on the same line tongue.gif
namespace Program
{
		 class Program
		 {
						static void Main(string[] args)
						{
						   Console.WriteLine("OliveOyl rocks!");
						   public const int tickertocker= 24;
						   //One line if-statements are made of awesome.
						   Console.WriteLine( (tickertocker % 5 == 0) ? "The time is a multiple of 5!" : "The time is not a multiple of 5!");
						   Console.WriteLine("Wow, we're definitely nerds... WE'RE AWESOME!");
						   //I fixed your grammar
						}
		 }
} 

This post has been edited by plasma-hand: 10 January 2010 - 06:19 PM


#8 borninlyoko   User is offline

  • D.I.C Regular
  • member icon

Reputation: 7
  • View blog
  • Posts: 350
  • Joined: 03-December 09

Re: One line Program C# version

Posted 10 January 2010 - 06:35 PM

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;//ya its a comment but its on the same line tongue.gif
namespace Program
{
		 class Program
		 {
						static void Main(string[] args)
						{
						   Console.WriteLine("OliveOyl rocks!");
						   public const int tickertocker= 24;
						   //One line if-statements are made of awesome.
						   Console.WriteLine( (tickertocker % 5 == 0) ? "The time is a multiple of 5!" : "The time is not a multiple of 5!");
						   Console.WriteLine("Wow, we're definitely nerds... WE'RE AWESOME!");
						   //I fixed your grammar
						  // Too bad this isn't written in LOLCODE 
						}
		 }
} 

This post has been edited by borninlyoko: 10 January 2010 - 06:36 PM


Page 1 of 1