Tutorial by Examples: c

A class, functions as a template that defines the basic characteristics of a particular object. Here's an example: class Person(object): """A simple class.""" # docstring species = "Homo Sapiens" ...
If logic of generic class or method requires checking equality of values having generic type, use EqualityComparer<TType>.Default property: public void Foo<TBar>(TBar arg1, TBar arg2) { var comparer = EqualityComparer<TBar>.Default; if (comparer.Equals(arg1,arg2) {...
By default the Large Object Heap is not compacted unlike the classic Object Heap which can lead to memory fragmentation and further, can lead to OutOfMemoryExceptions Starting with .NET 4.5.1 there is an option to explicitly compact the Large Object Heap (along with a garbage collection): GCSettin...
Prolog doesn't have iteration, but all iteration can be rewritten using recursion. Recursion appears when a predicate contains a goal that refers to itself. When writing such predicates in Prolog, a standard recursive pattern always has at least two parts: Base (non-recursive) clause: Typically...
Member member/2 has signature member(?Elem, ?List) and denotes true if Elem is a member of List. This predicate can be used to access variables in a list, where different solutions are retrieved through backtracking. Example queries: ?- member(X, [1,2,3]). X = 1 ; X = 2 ; X = 3. ?- member(X...
To simulate a phone call, press the 'Extended controls' button indicated by three dots, choose 'Phone' and select 'Call'. You can also optionally change the phone number.
Generic interfaces and delegates can have their type parameters marked as covariant or contravariant using the out and in keywords respectively. These declarations are then respected for type conversions, both implicit and explicit, and both compile time and run time. For example, the existing inte...
The ref keyword for callers of methods is now optional when calling into methods supplied by COM interfaces. Given a COM method with the signature void Increment(ref int x); the invocation can now be written as either Increment(0); // no need for "ref" or a place holder variable any m...
A new pseudo-type dynamic is introduced into the C# type system. It is treated as System.Object, but in addition, any member access (method call, field, property, or indexer access, or a delegate invocation) or application of an operator on a value of such type is permitted without any type checking...
XML <Galaxy> <Light>sun</Light> <Device>satellite</Device> <Sensor>human</Sensor> <Name>Milky Way</Name> </Galaxy> XPATH /Galaxy/*[local-name()='Light' or local-name()='Device' or local-name()='Sensor'] or //*[...
XML <Data> <BioLight> <name>Firefly</name> <model>Insect</model> </BioLight> <ArtificialLight> <name>Fire</name> <model>Natural element</model> <source>flint<...
XML <College> <FootBall> <Members>20</Members> <Coach>Archie Theron</Coach> <Name>Wild cats</Name> <StarFootballer>David Perry</StarFootballer> </FootBall> <Academics> ...
XML <College> <FootBall> <Members>20</Members> <Coach>Archie Theron</Coach> <Name>Wild cats</Name> <StarPlayer>David Perry</StarPlayer> </FootBall> <VolleyBall> <Me...
XML <Galaxy> <Light>sun</Light> <Device>satellite</Device> <Sensor>human</Sensor> <Name>Milky Way</Name> </Galaxy> XPATH /Galaxy/*[lower-case(local-name())="light"] or //*[lower-case(local-name())=&qu...
To create a function which accepts an undetermined number of arguments, there are two methods depending on your environment. 5 Whenever a function is called, it has an Array-like arguments object in its scope, containing all the arguments passed to the function. Indexing into or iterating over th...
XML <Galaxy> <name>Milky Way</name> <CelestialObject name="Earth" type="planet"/> <CelestialObject name="Sun" type="star"/> </Galaxy> XPATH /Galaxy/*[@name] or //*[@name] OUTPUT <CelestialObje...
XML <Galaxy> <name>Milky Way</name> <CelestialObject name="Earth" type="planet"/> <CelestialObject name="Sun" type="star"/> </Galaxy> XPATH /Galaxy/*[@name='Sun'] or //*[@name='Sun'] OUTPUT <C...
XML <Galaxy> <name>Milky Way</name> <CelestialObject name="Earth" type="planet"/> <CelestialObject name="Sun" type="star"/> </Galaxy> XPATH /Galaxy/*[contains(@name,'Ear')] or //*[contains(@name,'Ear...
XML <Galaxy> <name>Milky Way</name> <CelestialObject name="Earth" type="planet"/> <CelestialObject name="Sun" type="star"/> </Galaxy> XPATH /Galaxy/*[contains(lower-case(@name),'ear')] or //*[contain...
XML <Galaxy> <name>Milky Way</name> <CelestialObject name="Earth" type="planet"/> <CelestialObject name="Sun" type="star"/> </Galaxy> XPATH /Galaxy/*[starts-with(lower-case(@name),'ear')] or //*[star...

Page 247 of 826