Found 26504 Articles for Server Side Programming

Anonymous function in Dart Programming

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

887 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

344 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

616 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

Explain how the assemblies and DLLs work in .NET

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

700 Views

Assembly contains all the compiled types in your application along with their Intermediate Language (IL) code. It is also the basic unit of deployment in .NET. In the latest versions of .NET, i.e. .NET Core, an assembly is a file with a .dll extension, which stands for Dynamic Link Library.There are primarily four items in an assembly.Compiled TypesThe compiled IL code for all the types in your application.Assembly ManifestContains the metadata needed by the Common Language Runtime, such as the dependencies and versions that this DLL references.Its purpose is to describe the assembly to the runtime via the assembly's data, ... Read More

Explain the stream architecture in .NET

Akshay Khot
Updated on 19-May-2021 08:16:29

569 Views

The .NET streams architecture provides a consistent programming interface for reading and writing across different I/O types. It includes classes for manipulating files and directories on disk, as well as specialized streams for compression, named pipes, and memory-mapped files.The streaming architecture in .NET relies on a backing store and adapters.Backing StoreIt represents a store of data, such as a file or a network connection. It can act as either a source from which bytes can be read sequentially or a destination to which bytes can be written sequentially.The Stream class in .NET exposes the backing store to programmers. It exposes ... Read More

Explain the custom value types in .NET

Akshay Khot
Updated on 19-May-2021 08:15:02

1K+ Views

Variables of value types directly contain the values. When you assign one value type variable to another, each variable associates with a different storage location in memory. Hence, Changing the value of one value type variable doesn't affect the value in the second variable.Similarly, when you pass an instance of a value type to a method, the compiler copies the memory associated with the argument to a new location associated with the parameter. Any changes to the parameter won't affect the original value. Since memory is copied for value types, they should be small (typically, less than 16 bytes).All the ... Read More

What is the purpose of the StringBuilder class in C#?

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

472 Views

In C#, strings are immutable. That means you cannot modify a string once it's created. Any modification to the string returns a new string that contains the modification, leaving the original string intact.string word = "aaabbbccc"; string newWord = word.Replace('b', 'd'); Console.WriteLine(word); // prints aaabbbccc Console.WriteLine(newWord); // prints aaadddcccStringBuilder class represents a string-like object that can be modified, i.e. a mutable string of characters. It's implemented differently than the string type, which represents an immutable string of characters.As modifying a string object creates a copy, repeatedly modifying string objects can incur a performance penalty. For small repetitions it's negligible, but ... Read More

Advertisements