This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
<CodeSnippet Format="1.0.0"> | |
<Header> | |
<Title>cr</Title> | |
<Shortcut>cr</Shortcut> | |
<Description>Code snippet for Console.ReadLine</Description> | |
<Author>Whoever you want it to be</Author> | |
<SnippetTypes> | |
<SnippetType>Expansion</SnippetType> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ConsoleExtension | |
{ | |
public static void ToConsole<T>(this IEnumerable<T> s, string header) | |
{ | |
Console.WriteLine($"*********BEGIN {header}**************"); | |
foreach (T item in s) | |
{ | |
Console.WriteLine(item); | |
} | |
Console.WriteLine($"*********END {header}**************"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ConsoleExtension | |
{ | |
public static void ToConsole<T>(this IEnumerable<T> s, string header) | |
{ | |
Console.WriteLine($"*********BEGIN {header}**************"); | |
foreach (T item in s) | |
{ | |
Console.WriteLine(item); | |
} | |
Console.WriteLine($"*********END {header}**************"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FacebookWall: IEnumerable<Post> | |
{ | |
private List<Post> facebook; | |
public FacebookWall() | |
{ | |
facebook = new List<Post>(); | |
} | |
public void Add(Post npost) | |
{ | |
facebook.Add(npost); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
FacebookWall Facebook = new FacebookWall(); | |
Facebook.Add(new Post { status = "status A", timestamp = DateTime.Now }); | |
Facebook.Add(new Post { status = "status B", timestamp = DateTime.Now }); | |
Facebook.Add(new Post { status = "status C", timestamp = DateTime.Now }); | |
foreach(Post p in Facebook) | |
{ | |
Console.WriteLine($"Status: {p.status} - Datetime: {p.timestamp}"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FacebookWall | |
{ | |
private List<Post> facebook; | |
public FacebookWall() | |
{ | |
facebook = new List<Post>(); | |
} | |
public void Add(Post npost) | |
{ | |
facebook.Add(npost); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
List<Post> Facebook = new List<Post>(); | |
Facebook.Add(new Post { status = "status A", timestamp = DateTime.Now }); | |
Facebook.Add(new Post { status = "status B", timestamp = DateTime.Now }); | |
Facebook.Add(new Post { status = "status C", timestamp = DateTime.Now }); | |
foreach(Post p in Facebook) | |
{ | |
Console.WriteLine($"Status: {p.status} - Datetime: {p.timestamp}"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Post | |
{ | |
public string status { get; set; } | |
public DateTime timestamp { get; set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class HoangExtension | |
{ | |
public static void PlusWithHoang(this string s) | |
{ | |
Console.WriteLine($"{s} - Make from HoangExtension"); | |
} | |
} | |
class Program | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class [YOUR_CLASS_NAME] | |
{ | |
public static [RETURN_TYPE] [METHOD_NAME](this [TYPE_NAME] s) | |
{ | |
// TODO: Write code here | |
} | |
} | |
/* | |
---[YOUR_CLASS_NAME]---: What ever you like | |
---[RETURN_TYPE]---: What ever you want |