Skip to main content

Posts

Access Modifiers in C#

How many access modifiers in c# In this article, we will learn about the access modifiers in C#. 1. Public Access Modifier in C# The class member, that is defined as a Public can be accessed by other class members that are initialized outside the class. A public member can be accessed from anywhere even outside the namespace. public class Vehicle { public void Color() { Console.WriteLine("Vehicle color red"); } } 2. Private Access Modifier in C# The private access modifier restrict the member variable or function to be called outside of the parent class. A private function or variable cannot be called outside of the same class. It hides its member variable and method from other class and methods. public class Vehicle { private string Name; public void Color() { Console.WriteLine("Vehicle color red"); } } In the above example, you cannot call name variable outside the class because it is declared as private. 3. Protected

What is the sealed class in C#

In this article, we will learn about the sealed class and method in C#. C# Sealed Class A sealed class, in C#, is a class that cannot be inherited by any class but can be initiated. When we don't want a class can be inherited by another class, We can declare that class as sealed class. A sealed class cannot have a derived class. We use the sealed keyword to create a sealed class. sealed class Vehicle { } class Car : Vehicle { } class Program { public static void Main(string[] args) { Car car = new Car(); Console.ReadLine(); } } In the above example, we have created a sealed class Vehicle and then we are trying to derived Car class from the Vehicle class. when we are trying to compile code it'll give following errors.       C# Sealed Method When we don't want method can be override by another class, We can declare that method as sealed method. We use a sealed keyword with an overridden method to create a sealed method. class Vehicle

jQuery Selectors

How to find elements from HTML using jQuery In this article, you will learn about jQuery selectors and how to find DOM element(s) using selectors. The jQuery selector provides functionality to find DOM elements in your web page. jQuery selectors are one of the most important parts of the jQuery library. All selectors in jQuery start with the dollar sign and parentheses: $(). jQuery Selector Syntax $(selector expression) Example 1 : The .class Selector The jQuery .class selector allow you to finds all the elements with a specific class. If you want to find all the elements with class name "post-title" then the syntax will be as following. $(".post-title")   Example 2 : The #Id Selector The jQuery #Id selector allow you to finds the particular element with a specific Id. The Id selector will be used when you want to find single element from web page. $(document).ready(function(){ $("#btn-hide-title").click(function(){ $(".post-title").h

JavaScript Arrow Function

In this example, you will learn about JavaScript arrow function. Arrow function is one of the features introduced in the ES6 version of JavaScript. It allows you to create functions easy way compared to regular functions. Regular Function // regular function let result = function(a, b) { return a + b; } ES6 Arrow Function // arrow function let result = (a, b) => a + b; Arrow Function Syntax The syntax of the arrow function look like is: let myFunction = (arg1, arg2, ...argN) => { statement... } Here, myFunction is the function name arg1, arg2,...argN is the argument(parameter) of the function statement... is the body of the function

JavaScript Program to Remove Specific Item From an Array

How to Remove Specific Element From An Array In this example, you will learn to write a JavaScript program that will remove a specific element from an array. Example 1 : Using For Loop Remove Element From Array function removeElementFromArray(array, n) { const newArray = []; for ( let i = 0; i < array.length; i++) { if(array[i] !== n) { newArray.push(array[i]); } } return newArray; } const elements = [1, 2, 3, 4, 5]; const result = removeElementFromArray(elements, 4); console.log(result); Output [1,2,3,5] In the above program, an element 4 is removed from an array using a for loop. Example 2 : Using Array.splice() Remove Element From Array const elements = [1, 2, 3, 4, 5]; //remove element 3 const result = elements.splice(2,1); console.log(elements); Output [1, 2, 4, 5] In the above program, an element 3 is removed from an array using a splice() method.

How To Create Image Gallery in UWP Application

How to implement image gallery in gridview This article demonstrates how to make image gallery application using universal windows platform.  1. Let's start step by step. first of all open visual studio and create new blank UWP project as follows.     2. Click next and enter your project name and choose location where you want to save your project.   3. Click Create and choose target and minimum version that your UWP application will support.     4. Click Ok and your UWP project will created automatically and look like as following. 5. Now open MainPage.xaml file and enter below code between Grid tag. <NavigationView IsSettingsVisible= "False" IsBackButtonVisible= "Collapsed" > <NavigationView.MenuItems> <NavigationViewItem x:Name= "MenuImage" Tag= "image" Content= "Image Category" Icon= "Pictures" ></Navig

ASP.NET Core - Overview

What is ASP.NET Core? ASP.NET Core is a web framework created by Microsoft for building web applications, APIs, and microservices. It uses common patterns like MVC (Model-View-Controller), dependency injection, and a request pipeline comprised of middleware. It's open-source under the Apache 2.0 license, which means the source code is freely available, and the community is encouraged to contribute bug fixes and new features. ASP.NET Core runs on top of Microsoft's .NET runtime, similar to the Java Virtual Machine (JVM) or the Ruby interpreter. You can write ASP.NET Core applications in a number of languages (C#, Visual Basic, F#). C# is the most popular choice. You can build and run ASP.NET Core applications on Windows, Mac, and Linux. Why do we need another web framework? There are a lot of great web frameworks to choose from already: Node/Express, Spring, Ruby on Rails, Django, Laravel, and many more. What advantages does ASP.NET Core have?  Speed . ASP.NET Core is fast. Bec