Tutorial by Examples

Through the use of event types you can easily reduce code bloat that often occurs when defining events for many objects on stage by filtering events in 1 function rather than defining many event handling functions. Imagine we have 10 objects on stage named object1, object2 ... object10 You could d...
Sometimes it's a good idea to further secure your publishes by requiring a user login. Here is how you achieve this via Meteor. import { Recipes } from '../imports/api/recipes.js'; import { Meteor } from 'meteor/meteor'; Meteor.publish('recipes', function() { if(this.userId) { return Re...
int literals are defined by simply using integral values within the range of int: int i = 5;
uint literals are defined by using the suffix U or u, or by using an integral values within the range of uint: uint ui = 5U;
string literals are defined by wrapping the value with double-quotes ": string s = "hello, this is a string literal"; String literals may contain escape sequences. See String Escape Sequences Additionally, C# supports verbatim string literals (See Verbatim Strings). These are def...
char literals are defined by wrapping the value with single-quotes ': char c = 'h'; Character literals may contain escape sequences. See String Escape Sequences A character literal must be exactly one character long (after all escape sequences have been evaluated). Empty character literals are ...
byte type has no literal suffix. Integer literals are implicitly converted from int: byte b = 127;
sbyte type has no literal suffix. Integer literals are implicitly converted from int: sbyte sb = 127;
decimal literals are defined by using the suffix M or m on a real number: decimal m = 30.5M;
double literals are defined by using the suffix D or d, or by using a real number: double d = 30.5D;
float literals are defined by using the suffix F or f, or by using a real number: float f = 30.5F;
long literals are defined by using the suffix L or l, or by using an integral values within the range of long: long l = 5L;
ulong literals are defined by using the suffix UL, ul, Ul, uL, LU, lu, Lu, or lU, or by using an integral values within the range of ulong: ulong ul = 5UL;
short type has no literal. Integer literals are implicitly converted from int: short s = 127;
ushort type has no literal suffix. Integer literals are implicitly converted from int: ushort us = 127;
bool literals are either true or false; bool b = true;
let rec factorial n = match n with | 0 | 1 -> 1 | n -> n * (factorial (n - 1)) This function matches on both the values 0 and 1 and maps them to the base case of our recursive definition. Then all other numbers map to the recursive call of this function.
boot -d seancorfield/boot-new new -t app -n <appname> This command will tell boot to grab the task boot-new from https://github.com/seancorfield/boot-new and execute the task with the app template (see link for other templates). The task will create a new directory called <appname> wi...
Consider the following C# code Expression<Func<int, int>> expression = a => a + 1; Because the C# compiler sees that the lambda expression is assigned to an Expression type rather than a delegate type it generates an expression tree roughly equivalent to this code ParameterExpres...
Member functions of a class can be declared const, which tells the compiler and future readers that this function will not modify the object: class MyClass { private: int myInt_; public: int myInt() const { return myInt_; } void setMyInt(int myInt) { myInt_ = myInt; } }; In a ...

Page 334 of 1336