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.Threading; | |
| class Program | |
| { | |
| ~Program() | |
| { | |
| Console.WriteLine("Finalizer executed."); | |
| } |
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 Q75832457; | |
| using System.Text.Json; | |
| JsonSerializerOptions JsonSerializerOptions = new() | |
| { | |
| PropertyNameCaseInsensitive = true | |
| }; | |
| string json = @" | |
| [ |
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
| // This is a perfectly valid complete | |
| // program making use of implicit using directives | |
| // from C# 10, and top-level statements from C# 9. | |
| int x = 10; | |
| Console.WriteLine(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 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)); |