Programming Articles - Page 1187 of 3363

Bitwise operators in Dart Programming

Mukul Latiyan
Updated on 21-May-2021 12:26:03

4K+ Views

Bitwise operators are operators that are used to perform bit-level operations on operands. For example, consider two variables x and y where the values stored in them are 20 and 5 respectively.The binary representation of both these numbers will look something like this −x = 10100 y = 00101We make use of all the bitwise operators in Dart to perform on the values that are shown in the above table (bit values).In the below table all the bitwise operators that are present in Dart are mentioned.Consider the table as a reference.OperatorMeaningExampleDescription&Binary AND( x & y )Will produce 00100|Binary OR( x | ... Read More

Async and Await in Dart Programming

Mukul Latiyan
Updated on 21-May-2021 12:27:02

1K+ Views

Async and Await keywords are used to provide a declarative way to define the asynchronous function and use their results.The async keyword is used when we want to declare a function as asynchronous and the await keyword is used only on asynchronous functions.Syntaxvoid main() async { .. }If the function has a declared return type, then update the type of the Future to the return type.Future main() async { .. }And finally, we make use of await keyword when we want to wait for the asynchronous function to finish.await someAsynchronousFunction()ExampleLet's consider an example where we are declaring the main function ... Read More

Assignment operators in Dart Programming

Mukul Latiyan
Updated on 21-May-2021 13:16:05

2K+ Views

We make use of assignment operators whenever we want to assign values to a variable. There are times when we combine assignment operators with arithmetic operators and logical operators to build a shorthand version of both the assignment and arithmetic (or logical) expression. These shorthand versions are also known as compound statements.In the table below, all the assignment operators that are present in dart are mentioned.Consider the table shown below −OperatorDescriptionExpression=Assignment operatora = b+=Add and assign combineda += b is equivalent to a = a + b-=Subtract and assigna –= b is equivalent to a = a - b*=Multiply and ... Read More

Arithmetic operators in Dart Programming

Mukul Latiyan
Updated on 21-May-2021 13:18:14

1K+ Views

Arithmetic operators are used to perform different arithmetic operations.These arithmetic operations mainly are −AdditionSubtractionMultiplicationDivisionModulus, etc.Let's consider that we have two int variables named x and y, where x is storing the value 10 and y is storing the value 20.In the below table, you can see all the arithmetic operators, with their symbol, name, what output they yield etc.Consider the table shown below −OperatorNameDescriptionOutput+AdditionAddition of two or more operandsx + y = 30-SubtractionSubtraction of the second operand from the firstx - y = -10*MultiplicationMultiplication of two or more operandsx * y = 200/DivisionReturns quotient after divisionx / y = 0.5%ModulusReturns ... Read More

Anonymous function in Dart Programming

Mukul Latiyan
Updated on 21-May-2021 12:34:45

927 Views

A function without a name is known as an anonymous function. They behave in the exact same manner as a normal named function would. The only difference between the named and an anonymous function is how different they are in syntax.Anonymous functions are used in Dart to form closures. An anonymous function contains a self-contained block of codes, also it can be passed as a parameter to another function as well.Anonymous function Syntax(parameterList){    // inner statement(s) }ExampleNow, let's consider a simple example of an anonymous function.Consider the example shown below − Live Demovoid main() {    var fruits = ["Apple", ... Read More

Abstract Classes in Dart Programming

Mukul Latiyan
Updated on 21-May-2021 12:16:33

2K+ Views

Abstract classes in Dart are classes that contain one or more abstract methods.Note: Abstract methods are those methods that don't have any implementation.It should also be noted that a class in Dart can be declared abstract using the "abstract" keyword followed by the class declaration. A class that is declared using the abstract keyword may or may include abstract methods.An abstract class is allowed to have both the abstract methods and concrete methods (methods with implementation). Though, on the contrary, a normal class (non-abstract class) cannot have abstract methods.An abstract class is mainly used to provide a base for subclasses to extend and ... Read More

Explain the iterator pattern in .NET

Akshay Khot
Updated on 19-May-2021 12:50:41

371 Views

The iterator pattern is used to loop over the elements in a collection and is implemented using the IEnumerator interface. It defines the basic low-level protocol through which elements in a collection are traversed—or enumerated. This is done in a forward-only manner.Here's the IEnumerator interface in C#.public interface IEnumerator{    bool MoveNext();    object Current { get; }    void Reset(); }MoveNext advances the current element or "cursor" to the next position, returning false if there are no more elements in the collection.Current returns the element at the current position (usually cast from object to a more specific type). MoveNext ... Read More

How to work with XML and JSON in .NET?

Akshay Khot
Updated on 19-May-2021 08:19:11

1K+ Views

Working with JSONJSON is a data format that has become a popular alternative to XML. It is simple and uncluttered with a syntax similar to a JavaScript object. In fact, the term JSON stands for JavaScript Object Notation. The recent versions of .NET provide built-in support for working with JSON data.The System.Text.Json namespace provides high-performance, low-allocating features to process the JSON data. These features include serializing objects to JSON and deserializing JSON back into objects. It also provides types to create an in-memory document object model (DOM) for accessing any element within the JSON document, providing a structured view of ... Read More

Explain dependency injection in C#

Akshay Khot
Updated on 19-May-2021 08:18:30

16K+ Views

A dependency is an object that another object depends on. Dependency Injection (or inversion) is basically providing the objects that an object needs, instead of having it construct the objects themselves. It is a useful technique that makes testing easier, as it allows you to mock the dependencies.For example, if class A calls a method on class B, which in turn calls a method on class C, that means A depends on B and B depends on C. Using dependency injection, we can pass an instance of class C to class B, and pass an instance of B to class ... Read More

System.Reflection namespace in C#

Akshay Khot
Updated on 19-May-2021 08:17:54

637 Views

System.Reflection namespace in C# The System.Reflection namespace in C# contains the types that provide information about assemblies, modules, members, parameters, and other items in the code by examining the metadata. The Assembly class in this namespace represents an assembly. Typically, you can access it using the Assembly property on a Type.An assembly's identity consists of four items −Simple nameVersion from the AssemblyVersion attribute in the major.minor.build.revision format (0.0.0.0 if absent)Culture (neutral if not a satellite)Public key token (null if not strongly named)A fuller qualified assembly name is a string, and it includes these identifying items in the format −simple-name, Version=version, ... Read More

Advertisements