Tutorial by Examples

BindingList<string> listOfUIItems = new BindingList<string>(); listOfUIItems.Add("Alice"); listOfUIItems.Add("Bob");
Overview In this example 2 clients send information to each other through a server. One client sends the server a number which is relayed to the second client. The second client halves the number and sends it back to the first client through the server. The first client does the same. The server st...
Parentheses are now forbidden around named parameters. The following compiles in C#5, but not C#6 5.0 Console.WriteLine((value: 23)); Operands of is and as are no longer allowed to be method groups. The following compiles in C#5, but not C#6 5.0 var result = "".Any is byte; T...
Interfaces can be extremely helpful in many cases. For example, say you had a list of animals and you wanted to loop through the list, each printing the sound they make. {cat, dog, bird} One way to do this would be to use interfaces. This would allow for the same method to be called on all of th...
The JavaScriptSerializer.Deserialize<T>(input) method attempts to deserialize a string of valid JSON into an object of the specified type <T>, using the default mappings natively supported by JavaScriptSerializer. using System.Collections; using System.Web.Script.Serialization; // ....
internal class Sequence{ public string Name; public List<int> Numbers; } // ... string rawJSON = "{\"Name\":\"Fibonacci Sequence\",\"Numbers\":[0, 1, 1, 2, 3, 5, 8, 13]}"; Sequence sequence = JsonConvert.DeserializeObject<Seque...
Optional<String> optionalWithValue = Optional.of("foo"); optionalWithValue.ifPresent(System.out::println);//Prints "foo". Optional<String> emptyOptional = Optional.empty(); emptyOptional.ifPresent(System.out::println);//Does nothing.
DOM stands for Document Object Model. It is an object-oriented representation of structured documents like XML and HTML. Setting the textContent property of an Element is one way to output text on a web page. For example, consider the following HTML tag: <p id="paragraph"></p&g...
Introduction All modern web browsers, NodeJs as well as almost every other JavaScript environments support writing messages to a console using a suite of logging methods. The most common of these methods is console.log(). In a browser environment, the console.log() function is predominantly used f...
A normal function declaration looks like this: function foo(){ } A function defined like this is accessible from anywhere within its context by its name. But sometimes it can be useful to treat function references like object references. For example, you can assign an object to a variable based...
There are many ways to create arrays. The most common are to use array literals, or the Array constructor: var arr = [1, 2, 3, 4]; var arr2 = new Array(1, 2, 3, 4); If the Array constructor is used with no arguments, an empty array is created. var arr3 = new Array(); results in: [] Note...
Spread operator 6 With ES6, you can use spreads to separate individual elements into a comma-separated syntax: let arr = [1, 2, 3, ...[4, 5, 6]]; // [1, 2, 3, 4, 5, 6] // in ES < 6, the operations above are equivalent to arr = [1, 2, 3]; arr.push(4, 5, 6); The spread operator also act...
In JavaScript, functions may be anonymously defined using the "arrow" (=>) syntax, which is sometimes referred to as a lambda expression due to Common Lisp similarities. The simplest form of an arrow function has its arguments on the left side of => and the return value on the right...
PHP can be used to add content to HTML files. While HTML is processed directly by a web browser, PHP scripts are executed by a web server and the resulting HTML is sent to the browser. The following HTML markup contains a PHP statement that will add Hello World! to the output: <!DOCTYPE html&gt...
Start by defining a Foo function that we'll use as a constructor. function Foo (){} By editing Foo.prototype, we can define properties and methods that will be shared by all instances of Foo. Foo.prototype.bar = function() { return 'I am bar'; }; We can then create an instance using the ...
Defining an Anonymous Function When a function is defined, you often give it a name and then invoke it using that name, like so: foo(); function foo(){ // ... } When you define a function this way, the Javascript runtime stores your function in memory and then creates a reference to th...
var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function () { if (xhttp.readyState === XMLHttpRequest.DONE && xhttp.status === 200) { //parse the response in xhttp.responseText; } }; xhttp.open("GET", "ajax_info.txt", true); xhttp.send(...
Python is a widely used high-level programming language for general-purpose programming, created by Guido van Rossum and first released in 1991. Python features a dynamic type system and automatic memory management and supports multiple programming paradigms, including object-oriented, imperative, f...
echo and print are language constructs, not functions. This means that they don't require parentheses around the argument like a function does (although one can always add parentheses around almost any PHP expression and thus echo("test") won't do any harm either). They output the string r...
Unlike in languages like Python, static properties of the constructor function are not inherited to instances. Instances only inherit from their prototype, which inherits from the parent type's prototype. Static properties are never inherited. function Foo() {}; Foo.style = 'bold'; var foo = ne...

Page 26 of 1336