Skip to content

Instantly share code, notes, and snippets.

@ypetya
Created February 13, 2012 19:00
Show Gist options
  • Save ypetya/1819097 to your computer and use it in GitHub Desktop.
Save ypetya/1819097 to your computer and use it in GitHub Desktop.
c#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
private int myVar;
public int MyProperty
{
get { return myVar; }
set { myVar = value; }
}
delegate Boolean del1(String param);
Boolean valami(String param)
{
return param.Length > 5;
}
void valamiVoid(String param)
{
valami(param);
}
private void foo(String s1, String s2 = "opt2", String s3 = "aaa")
{
}
public void run()
{
Console.WriteLine("Hello world!");
var l = new List<String>{ "Miki", "Peti", "Levis", "Krisztian" };
l.Where(s => s.Length > 4).Select(s => s).ToList().ForEach( w => Console.WriteLine( w ));
foo("s1", s3: "sdsd");
var ie = from s in l
where s.Length > 4
select new { alma = s };
var sss = new { Nev = "mmmm" };
del1 fv = new del1(this.valami);
foreach (var nev in l)
{
if (!fv(nev))
{
Console.WriteLine(nev);
}
}
Func<String, Boolean> f = s =>
{
Console.WriteLine("dolgozok, turelem...");
return s.Length > 5;
};
Action<String> f2 = valamiVoid;
Console.ReadLine();
}
static void Main(string[] args)
{
Program p = new Program();
p.run();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment