Tutorial by Examples: ti

Projection refers to the operations of transforming an object into a new form. Select Projects values that are based on a transform function. Method Syntax // Select var numbers = new int[] { 1, 2, 3, 4, 5 }; var strings = numbers.Select(n => n.ToString()); // strings = { "1...
A sorting operation orders the elements of a sequence based on one or more attributes. OrderBy Sorts values in ascending order. Method Syntax // OrderBy var numbers = new int[] { 5, 4, 8, 2, 7, 1, 9, 3, 6 }; var ordered = numbers.OrderBy(n => n); // ordered = { 1, 2, 3, 4, 5, 6, ...
Conversion operations change the type of input objects. AsEnumerable Returns the input typed as IEnumerable. Method Syntax // AsEnumerable int[] numbers = { 1, 2, 3, 4, 5 }; var nums = numbers.AsEnumerable(); // nums: static type is IEnumerable<int> Query Syntax // Not app...
Aggregation operations computes a single value from a collection of values. Aggregate Performs a custom aggregation operation on the values of a collection. Method Syntax // Aggregate var numbers = new int[] { 1, 2, 3, 4, 5 }; var product = numbers.Aggregate(1, (acc, n) => acc * n);...
Quantifier operations return a Boolean value that indicates whether some or all of the elements in a sequence satisfy a condition. All Determines whether all the elements in a sequence satisfy a condition. Method Syntax // All var numbers = new int[] { 1, 2, 3, 4, 5 }; bool areLessThan...
Grouping refers to the operations of putting data into groups so that the elements in each group share a common attribute. GroupBy Groups elements that share a common attribute. Method Syntax // GroupBy class Order { public string Customer { get; set; } public string Descriptio...
Partitioning refers to the operations of dividing an input sequence into two sections, without rearranging the elements, and then returning one of the sections. Skip Skips elements up to a specified position in a sequence. Method Syntax // Skip var numbers = new int[] { 1, 2, 3, 4, 5 }; ...
Generation refers to creating a new sequence of values. DefaultIfEmpty Replaces an empty collection with a default valued singleton collection. Method Syntax // DefaultIfEmpty var nums = new int[0]; var numbers = nums.DefaultIfEmpty(); // numbers = { 0 } Query Syntax // Not appl...
Set operations refer to query operations that produce a result set that is based on the presence or absence of equivalent elements within the same or separate collections (or sets). Distinct Removes duplicate values from a collection. Method Syntax // Distinct var numbers = new int[] { 1,...
Two sequences whose corresponding elements are equal and which have the same number of elements are considered equal. SequenceEqual Determines whether two sequences are equal by comparing elements in a pair-wise manner. Method Syntax // SequenceEqual var numbers1 = new int[] { 1, 2, 3, 4,...
Element operations return a single, specific element from a sequence. ElementAt Returns the element at a specified index in a collection. Method Syntax // ElementAt var strings = new string[] { "zero", "one", "two", "three" }; var str = strings.E...
When you bind a service to your application credentials become available through the VCAP_SERVICES environment variable. This environment variable contains JSON containing the credentials for all bound services. Example VCAP_SERVICES environment variable { "push-reappt": [ { ...
String#replace can have a function as its second argument so you can provide a replacement based on some logic. "Some string Some".replace(/Some/g, (match, startIndex, wholeString) => { if(startIndex == 0){ return 'Start'; } else { return 'End'; } }); // will retur...
app.js angular.module('myApp', ['ui.router']) .controller('controllerOne', function() { this.message = 'Hello world from Controller One!'; }) .controller('controllerTwo', function() { this.message = 'Hello world from Controller Two!'; }) .controller('controllerThree', funct...
nginx consists of modules which are controlled by directives specified in the configuration file. Simple Directives A simple directive consists of the name and parameters separated by spaces and ends with a semicolon (;). Block Directive A block directive has the same structure as a simple direc...
Stream is especially useful when you want to run multiple operations on a collection. This is because Stream is lazy and only does one iteration (whereas Enum would do multiple iterations, for example). numbers = 1..100 |> Stream.map(fn(x) -> x * 2 end) |> Stream.filter(fn(x) -> rem(x...
You can add your own validations adding new classes inheriting from ActiveModel::Validator or from ActiveModel::EachValidator. Both methods are similar but they work in a slightly different ways: ActiveModel::Validator and validates_with Implement the validate method which takes a record as an arg...
Classic unit tests test state, but it can be impossible to properly test methods whose behavior depends on other classes through state. We test these methods through interaction tests, which verify that the system under test correctly calls its collaborators. Since the collaborators have their own...
The policy builder allows you to build sophisticated policies. app.UseCors(builder => { builder.WithOrigins("http://localhost:5000", "http://myproductionapp.com") .WithMethods("GET", "POST", "HEAD") .WithHeaders(&quo...
To get SSIS working for a SQL Server 2005 environment Acquire SQL Server 2005 (x86 or 64 bit) images. Mount the second disk and launch the installation wizard "Next" your way through the dialogs until you see see this screen. Under Client Components, ensure Business Intelligence De...

Page 123 of 505