This file contains hidden or 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 Microsoft.Extensions.DependencyInjection; | |
using Microsoft.Extensions.Hosting; | |
class Program | |
{ | |
static async Task Main() | |
{ | |
using IHost host = Host.CreateDefaultBuilder() | |
.ConfigureServices(services => |
This file contains hidden or 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
delegate void SampleDelegate(string text); | |
class Test | |
{ | |
static void Main() | |
{ | |
string x = ""; | |
var del = new SampleDelegate(Method, x); | |
} |
This file contains hidden or 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.Text; | |
public class Program | |
{ | |
static void Main() | |
{ | |
var builder = new StringBuilder(); | |
for (int i = 0; i < 256; i++) | |
{ |
This file contains hidden or 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
import org.json.JSONObject; | |
public class Test { | |
public static void main(String args[]) { | |
String json = "{ \"status\": \"failed\", \"message\": \"All fields are required\" }"; | |
JSONObject jsonObject = new JSONObject(json); | |
String status = jsonObject.getString("status"); | |
String message = jsonObject.getString("message"); |
This file contains hidden or 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.IO; | |
using System.Collections.Generic; | |
public interface IWriterService | |
{ | |
Stream WriteTXT<T>(List<T> content, string delimator, string header = "", bool isHeader = false) where T : class; | |
} | |
public class WriterService : IWriterService |
This file contains hidden or 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.IO; | |
using System.Collections.Generic; | |
public interface IWriterService | |
{ | |
Stream WriteTXT<T>(List<T> content, string delimiter, | |
string header, bool isHeader) | |
where T : class; | |
} |
This file contains hidden or 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; | |
using System.Linq; | |
List<string> list1 = new List<string> {"1", "2", "3"}; | |
List<string> list2 = new List<string> {"1", "2", "3"}; | |
// Prints True | |
Console.WriteLine(list1.SequenceEqual(list2)); |
This file contains hidden or 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; | |
public class Math | |
{ | |
public virtual int Sum(int a , int b) | |
{ | |
return a+b; | |
} | |
} |
This file contains hidden or 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 Newtonsoft.Json; | |
string json = "{\"Code\":\"AA10\",\"day\":\"monday\",\"errors\":[]}"; | |
var newyvar = JsonConvert.DeserializeObject<Dictionary<string, object>>(json); | |
string new_row = Convert.ToString(newyvar["Code"]) + ";" + "New"; | |
Console.WriteLine(new_row); |
This file contains hidden or 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 Newtonsoft.Json; | |
string json = "{\"id\":\"5005t000004RMNTAA4\",\"success\":true,\"errors\":[]}"; | |
var dict = JsonConvert.DeserializeObject<Dictionary<string, object>>(json); | |
Console.WriteLine(string.Join(", ", dict.Keys)); |