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
// See https://aka.ms/new-console-template for more information | |
using Microsoft.CodeAnalysis.CSharp; | |
using Microsoft.CodeAnalysis.CSharp.Syntax; | |
public class Demo | |
{ | |
private static Dictionary<string, List<string>> _classWisePropMap | |
= new Dictionary<string, List<string>>(); |
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
void Main() | |
{ | |
string csvFile = @"C:\MLDOTNET\iris.csv"; | |
var columns = File.ReadLines(csvFile) | |
.Take(1) | |
.First() | |
.Split(new char[] { ',' }); | |
var firstLine = File.ReadLines(csvFile) | |
.Skip(1) | |
.Take(1) |
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
package hello | |
fun main() { | |
var x = 11 | |
var y = if (x > 10) { println("Hey!"); ":Kotlin"} else | |
{ | |
println("NO!") | |
"OUCH!" | |
} | |
println(y) |
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
package hello | |
fun main() { | |
var xs = listOf(listOf(1,2,3), | |
listOf(1,5,6,2), | |
listOf(7,8,2,11,1)) | |
var result = xs[0] | |
for(i in 1 .. xs.size - 1) | |
{ | |
result = result.intersect(xs[i]).toList() |
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
void Main() | |
{ | |
Cartesian<string>(new List<List<string>>() | |
{ | |
new List<string>() { "A", "B" }, | |
new List<string>() { "C", "D", "E" } | |
}).Dump(); | |
} | |
public static List<List<T>> Cartesian<T>(List<List<T>> sets) |
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
let rainfall = [[1.17;0.78];[1.24;3.22];[1.277;1.4]] | |
let months = [|"January";"February"|] | |
let rainfalStats = [ 0 .. months.Length - 1] | |
|> List.map | |
( | |
fun index -> | |
( | |
months.[index], | |
rainfall |> List.map (fun row -> List.nth row index) |
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[] words = new string[] | |
{"zebra","beard","duck","zest", "ducklin", "bearcat","dumb","beautiful","zebracrossing"}; | |
//{ "zebra", "dog", "duck", "zimbawae", "zest","god","dove", "dig","got","dumb"}; | |
Array.Sort(words); | |
Func<string, string, int> DiffersAt = (a, b) => | |
{ | |
int m = a.Length; | |
int n = b.Length; |
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[] words = new string[] | |
{"zebra","beard","duck","zest", "ducklin", "bearcat","dumb","beautiful","zebracrossing"}; | |
//{ "zebra", "dog", "duck", "zimbawae", "zest","god","dove", "dig","got","dumb"}; | |
Array.Sort(words); | |
Func<string, string, int> DiffersAt = (a, b) => | |
{ | |
int m = a.Length; | |
int n = b.Length; |
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
//Avoid Boxing | |
var code = @"public void fun(){int x = 32; | |
object o = x;}"; | |
var tree = CSharpSyntaxTree.ParseText(code); | |
//x - Int |
NewerOlder