-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConsoleWritelineObject.dib
41 lines (30 loc) · 1.18 KB
/
ConsoleWritelineObject.dib
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
#!meta
{"kernelInfo":{"defaultKernelName":null,"items":[{"name":"csharp","languageName":"C#","aliases":["c#","cs"]},{"name":"fsharp","languageName":"F#","aliases":["f#","fs"]},{"name":"pwsh","languageName":"PowerShell","aliases":["powershell"]},{"name":"javascript","languageName":"JavaScript","aliases":["js"]},{"name":"html","languageName":"HTML"},{"name":"sql","languageName":"SQL"},{"name":"kql","languageName":"KQL"},{"name":"mermaid","languageName":"Mermaid"},{"name":"httpRequest","languageName":"http"},{"name":"value"}]}}
#!markdown
# Print Object to Terminal
Output:
#!csharp
public class Admin
{
public string name = "admin";
public string adminName = "admin";
public string password = "password";
public string email = "admin@localhost";
public bool isSuperAdmin = true;
public Admin()
{
}
}
var admin = new Admin();
void WriteObjectToConsole(object obj)
{
var properties = obj.GetType().GetProperties();
foreach (var property in properties)
{
Console.WriteLine("{0,-20}: {1,-20}", property.Name, property.GetValue(obj));
}
}
WriteObjectToConsole(admin);
#!markdown
# Print Object to Terminal
Output: