/
Program.cs
62 lines (51 loc) · 1.66 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Development
{
class Program
{
static void Main(string[] args)
{
LinqExample.main();
CollectionExample.main();
DelegateExample.main();
StringBuilderExample.main();
DisposeExample.main();
ReferencesExample.main();
Customer.main();
Console.WriteLine("All done");
}
}
// In order to support LINQ, a feature called extension methods have been added.
// These methods bolted onto a type by some other type.
// You can add new methods to a type even if you can't change that type.
// If the class is added to a namespace and that namespace is addedto a class then any string will have the extension method.
// SELECT and WHERE are examples of LINQ operators and extension methods defined by the System.Linq namespace from the static class Enumerable
// The Enumerable class defines these 2 methods and others for the IEnumerable<T>
static class StringAdditions // Must be a static class.
{
// Must be a static function.
public static string Backwards(this string input) // Must specify this keyword as the first parameter.
{
char[] characters = input.ToCharArray();
Array.Reverse(characters);
return new string(characters);
}
}
class Apple
{
public String Colour
{
get;
set;
}
public String AppleType
{
get;
set;
}
}
}