Repository navigation
Expand file tree
/
Copy pathProgram.cs
More file actions
54 lines (41 loc) · 1.76 KB
/
Copy pathProgram.cs
File metadata and controls
54 lines (41 loc) · 1.76 KB
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
using AttributesExamples;
using System;
namespace DemoAttributeExamples
{
class Program
{
static void Main(string[] args)
{
EnumAsBitFieldDemo();
Console.ReadLine();
}
static void ParsingConfigurationFileDemo()
{
var settings = Application.LoggingConfig;
Console.WriteLine($"Log Name: {settings.LogName}");
Console.WriteLine($"Log Location: {settings.LogPath}");
Console.WriteLine($"Severity Level: {settings.SeverityLevel}");
Console.WriteLine($"Logging {(settings.LoggingEnabled ? @"is" : @"is not")} enabled.");
}
static void PlannedCodeObsolescenceDemo()
{
var p = new PlannedCodeObsolescence();
p.SetName("Tiny Tim");
// p.AgeSet(5);
}
static void EnumAsBitFieldDemo()
{
var prefContactMethods = PreferredContactMethods.Email | PreferredContactMethods.FlooPowder;
if (prefContactMethods == PreferredContactMethods.None)
Console.WriteLine("User hates people. :("); // won't print
if (prefContactMethods.HasFlag(PreferredContactMethods.LandPhone))
Console.WriteLine("What's a landph one? :/"); // also won't print
if (prefContactMethods.HasFlag(PreferredContactMethods.CellPhone)
|| prefContactMethods.HasFlag(PreferredContactMethods.Email))
Console.WriteLine("Aren't we modern? :p"); // should print
prefContactMethods |= PreferredContactMethods.Owl;
if (prefContactMethods.HasFlag(PreferredContactMethods.Wizard))
Console.WriteLine("You're a wizard Harry!! ~:›"); // this too
}
}
}