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.Data.SqlClient; | |
| SqlCommand sqlCommand = new SqlCommand(); | |
| sqlCommand.CommandText = "SELECT * FROM dbo.USERS"; | |
| sqlCommand.CommandType = System.Data.CommandType.Text; | |
| Console.WriteLine(sqlCommand.CommandText); |
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
| class Test | |
| { | |
| static void Main() | |
| { | |
| Bogus bogus = null; | |
| System.Console.WriteLine(bogus == null); | |
| } | |
| } | |
| class Bogus |
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 java.text.Collator; | |
| import java.util.*; | |
| public class CzechCollationTest { | |
| public static void main(String[] args) { | |
| Locale locale = new Locale("cs"); | |
| List<String> words = Arrays.asList( | |
| "Účetnictví", "Udržitelná", "Uhlovodíky", "Vízová", | |
| "Česká", "Řízení", "Škola", "Životní", "Chlé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
| public class NeedExtension<T> | |
| { | |
| } | |
| public static class Extensions | |
| { | |
| public static NeedExtension<T> DoSomething<T>(this NeedExtension<T> obj) | |
| { | |
| return obj; | |
| } |
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
| double[] inputs = { -10.0, -6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 0.001, 1.0, 2.0, 5.0, 6.0, 10.0, 12.0, 15.0, 25.0 }; | |
| foreach (var input in inputs) | |
| { | |
| var output = WrapPositive(10L, input); | |
| Console.WriteLine($"{input} => {output}"); | |
| } | |
| double WrapPositive(double periodicDistance, double position) => | |
| (position % periodicDistance + periodicDistance) % periodicDistance; |
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
| namespace Other | |
| { | |
| public class List<T> | |
| { | |
| } | |
| } | |
| namespace Test | |
| { | |
| using Other; |
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.Text.Json; | |
| IUser user = new User("Jon", "Reading"); | |
| string json = JsonSerializer.Serialize(user); | |
| Console.WriteLine(json); | |
| public interface IUser | |
| { | |
| string Name { get; } |
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
| class Program | |
| { | |
| static void Main() | |
| { | |
| Dictionary<string, object> dict1 = new Dictionary<string, object>() | |
| { | |
| {"Key1","1"}, | |
| {"Key2",2}, | |
| {"Key3","4"}, | |
| {"Key4",3}, |
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.Linq; | |
| using System.Xml.Linq; | |
| var doc = XDocument.Load("test.xml"); | |
| var matches = doc | |
| .Descendants("aircraft_info") | |
| .Where(ft => ((string)ft.Element("aircraft_name")) == "Default"); | |
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
| string json = "[{\"InstanceName\":\"MyInstance\",\"name\":\"serverparam\",\"id\":\"01\"}]"; | |
| var result = System.Text.Json.JsonSerializer.Deserialize(json, typeof(Dictionary<string, string>[])); | |
| var array = (Dictionary<string, string>[]) result!; | |
| Console.WriteLine(array[0]["InstanceName"]); |
NewerOlder