This file contains 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
// 1. Update using statements: | |
// Old Bridge.Html5 | |
using Bridge.Html5; | |
// New Retyped | |
using static Retyped.dom; | |
// 2. Class names should be the same: |
This file contains 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
// Create a new Button Element | |
var button = new HTMLButtonElement(); | |
// Set the Button text | |
button.innerHTML = "Click Me"; | |
// Add a Click event handler | |
button.addEventListener("click", () => | |
{ | |
// Write a message to the Console |
This file contains 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
<!DOCTYPE html> | |
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>MyApp</title> | |
<script src="bridge.js"></script> | |
<script src="bridge.console.js"></script> | |
<script src="demo.js"></script> |
This file contains 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
{ | |
"html": { | |
"disabled": true | |
} | |
} |
This file contains 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
Product product = new Product(); | |
product.Name = "Apple"; | |
product.ExpiryDate = new DateTime(2008, 12, 28); | |
product.Price = 3.99M; | |
product.Sizes = new string[] { "Small", "Medium", "Large" }; | |
string output = JsonConvert.SerializeObject(product); | |
//{ |
This file contains 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
// We need the Timer reference to have access to it in the callback | |
public static Timer timer; | |
// A flag of changing the Timer's due time and period | |
public static bool timerChanged; | |
public static void Main() | |
{ | |
// The Timer callback | |
TimerCallback callback = (state) => |
This file contains 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
var watch = Stopwatch.StartNew(); | |
Console.WriteLine(watch.ElapsedMilliseconds); | |
Console.WriteLine("Waiting..."); | |
Global.SetTimeout(() => | |
{ | |
Console.WriteLine(watch.ElapsedMilliseconds); | |
}, 2000); |
This file contains 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
var watch = System.Diagnostics.Stopwatch.StartNew(); | |
Console.WriteLine(watch.ElapsedMilliseconds); | |
Thread.Sleep(2000); // Block for 2 seconds | |
Console.WriteLine(watch.ElapsedMilliseconds); |
This file contains 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 App | |
{ | |
public static void Main() | |
{ | |
Random rnd = new Random(); | |
int lowerBound = 10; | |
int upperBound = 11; | |
int[] range = new int[10]; |
This file contains 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 App | |
{ | |
public static void Main() | |
{ | |
Console.WriteLine("int.MaxValue: " + int.MaxValue); | |
Console.WriteLine("Factorial of 12: " + App.Factorial(12)); | |
Console.WriteLine("Factorial of 13: " + App.Factorial(13)); // exceeds int.MaxValue | |
Console.WriteLine("long.MaxValue: " + long.MaxValue); | |
Console.WriteLine("Factorial of 20: " + App.Factorial(20)); |