
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

346 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

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

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

621 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

704 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

574 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

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

476 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

396 Views
A C# program compiles to a DLL assembly that contains the compiled C# code along with the metadata for the runtime, and other resources. C# provides a reflection API that lets us inspect the metadata and compiled code at runtime.Using reflection, it's possible to −Access the assembly metadata for all types inside the assemblyObtain a list of types and their members (methods, properties, etc.)Dynamically invoke the type members at runtime.Instantiate objects by only providing their nameBuild assembliesIn a traditional program, when you compile the source code to the machine code, the compiler removes all the metadata about the code. However, ... Read More

631 Views
.NET contains a lot of namespaces and many more, if you include the third-party libraries. However, there are a few that you will use over and over. Here are the twenty that will get you through 80% of the common, recurring programming problems.SystemContains the most fundamental types. These include commonly used classes, structures, enums, events, interfaces, etc.System.TextContains classes that represent ASCII and Unicode character encodings. Classes for converting blocks of characters to and from blocks of bytes.System.Text.RegularExpressionsProvides regular expression functionality.System.LinqProvides classes and interfaces that support queries that use Language-Integrated Query (LINQ).System.XML.LinqContains the classes for LINQ to XML. LINQ to XML ... Read More