Skip to content

Instantly share code, notes, and snippets.

@manofi21
Created October 3, 2023 05:34
Show Gist options
  • Save manofi21/bda93fc63301b0da4602e3dba80b0168 to your computer and use it in GitHub Desktop.
Save manofi21/bda93fc63301b0da4602e3dba80b0168 to your computer and use it in GitHub Desktop.

Comparation Dart x C#

final listValue = <int>[1,2,3];
listValue.fold(0, (a, b) => a + b);
List<int> ar = [1,2,3];
int result = ar.Aggregate(0, (acc, x) => acc + x);

Table Of Comparation

Dart C#
print Console.WriteLine
int myNum = 5;
double myDoubleNum = 5.99;
bool myBool = true;
String myText = "Hello";
int myNum = 5;
double myDoubleNum = 5.99D;
char myLetter = 'D';
bool myBool = true;
string myText = "Hello";
const int myNum = 15; const int myNum = 15;
late int x, y, z;
x = y = z = 50;
int x, y, z;
x = y = z = 50;
String firstName = "John ";
String lastName = "Doe";
String fullName = firstName + lastName;
string firstName = "John ";
string lastName = "Doe";
string fullName = firstName + lastName;
myInt.toString();
myInt.toDouble();
Convert.ToString(myInt);
Convert.ToDouble(myInt);
Convert.ToInt32(myDouble);
Convert.ToString(myBool);
string userName = Console.ReadLine();
String txt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
txt.length;
string txt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
txt.Length;
String txt = "harasm";
txt.toUpperCase();
txt.toLowerCase();
string txt = "Hello World";
txt.ToUpper();
txt.ToLower();
String firstName = "John";
String lastName = "Doe";
String name = "My full name is: ${firstName} ${lastName}";
string firstName = "John";
string lastName = "Doe";
string name = $"My full name is: {firstName} {lastName}";
String name = "Rays";
name.indexOf("R");
name.substring(0, 2);
string name = "Rays";
name.IndexOf("R");
name.Substring(0, 2);
List myNumber = [5,1,8,9];


myNumber.sort();
int[] myNumbers = {5, 1, 8, 9};
List myNumbers = new List {5, 1, 8, 9};

Array.Sort(myNumbers);
void myMethod() {
print("I Jut....");
}
void myMethod([string country = "Norway"]) {
print(country);
}
int myMethod(int x) {
return 5 + x;
}
static void MyMethod() {
Console.WriteLine("I just got executed!");
}
static void MyMethod(string country = "Norway") {
Console.WriteLine(country);
}
static int MyMethod(int x) {
return 5 + x;
}
void main() {
myMethod("value", "asd", "lioa");
myMethod(child1: "value", child2: "asd", child3: "lioa");
}

void myMethod(string child1, string child2, string child3) {
print("The youngest child is: " + child3);
}

void myMethod({required string child1,required string child2,required string child3}) {
print("The youngest child is: " + child3);
}
static void Main() {
MyMethod("value", "asd", "lioa");
MyMethod(child1: "value", child2: "asd", child3: "lioa");
}

static void MyMethod(string child1, string child2, string child3) {
Console.WriteLine("The youngest child is: " + child3);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment