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
using System; | |
namespace ConsoleApplication1 | |
{ | |
// Declare delegate | |
public delegate int mathDelegate(int a, int ab); | |
class EventDelegateClass | |
{ | |
// event of type mathDelegate |
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
using System; | |
using System.Collections.Generic; | |
namespace PatternsByVS | |
{ | |
public class Book | |
{ | |
public string Title { get; set; } | |
public string Pages { 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
using System; | |
using System.Collections.Generic; | |
namespace PatternsByVS | |
{ | |
public class Resource | |
{ | |
private Resource() | |
{ | |
Console.WriteLine("Resource created..."); |
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
string Serialize<T>(MediaTypeFormatter formatter, T value) | |
{ | |
// Create a dummy HTTP Content. | |
Stream stream = new MemoryStream(); | |
var content = new StreamContent(stream); | |
/// Serialize the object. | |
formatter.WriteToStreamAsync(typeof(T), value, stream, content, null).Wait(); | |
// Read the serialized string. | |
stream.Position = 0; | |
return content.ReadAsStringAsync().Result; |