Item Property of SortedList Class in C#

karthikeya Boyini
Updated on 23-Jun-2020 11:38:52

94 Views

A sorted list is a combination of an array and a hash table. It contains a list of items that can be accessed using a key or an index.Gets and sets the value associated with a specific key in the SortedList.You can also use the Item property to add new elements.If a key does not exist, then you can include it like.myCollection["myNonexistentKey"] = myValueIf the key already exist, then it will overwrite it with the new key and value.The following is an example to learn how to work with Item property of SorteList class in C#.Example Live Demousing System; using System.Collections; ... Read More

Set All Border Top Properties in One Declaration with JavaScript

Monica Mona
Updated on 23-Jun-2020 11:38:38

275 Views

To set all the border top properties in a single declaration, use the borderTop property. With this property, you can set the border-top-width, border-top-style, and border-top-color property.ExampleYou can try to run the following code to learn how to work with border-top properties in JavaScript −Live Demo                    #box {             border: thick solid gray;             width: 300px;             height: 200px          }                     Demo Text             Change top border                function display() {             document.getElementById("box").style.borderTop = "thick solid #000000";          }          

Scope of Protected Internal Member Variable in C#

Chandu yadav
Updated on 23-Jun-2020 11:38:17

342 Views

The protected internal access specifier allows a class to hide its member variables and member functions from other class objects and functions, except a child class within the same application.In the below example, the derived class object can access the protected internal variable.Example Live Demousing System; class One {    protected internal int a = 50;    private int b; } class Two : One {    public Two() {       Console.WriteLine(this.a);    } } class Demo {    static void Main() {       Two t = new Two();       // allowed since it is a derived class object       t.a = 20;    } }Output50

Find Minimum Between 2 Numbers Using C#

Samual Sam
Updated on 23-Jun-2020 11:37:27

2K+ Views

Firstly, declare and initialize two numbers.int num1 = 35; int num2 = 55;With that, use if- else to find the minimum number.if (num1 < num2) {    minNum = num1; } else {    minNum = num2; }Above, we have set the minimum value to the variable minNum and printed it later on.The following is the complete example to find minimum between 2 numbers in C#.Example Live Demousing System; namespace Demo {    class Program {       static void Main(string[] args) {          int num1 = 50;          int num2 = 90;   ... Read More

Set Line Breaking Rules for Non-CJK Scripts in JavaScript

Govinda Sai
Updated on 23-Jun-2020 11:37:20

273 Views

Use the wordbreak property in JavaScript to set line breaking rules for non-CJK scripts. The following are CJK scripts: C for Chinese, J for Japanese, K for Korean.ExampleYou can try to run the following code to learn how to implement wordbreak property −                    #box {             width: 150px;             height: 120px;             background-color: lightblue;             border: 1px solid black;          }                     Set                This is Demo Text.This is Demo Text.This is Demo Text.This is Demo Text.This is Demo Text.This is Demo Text.                      function display() {             document.getElementById("box").style.wordBreak = "break-all";          }          

Scope of a Protected Member Variable in C#

Ankith Reddy
Updated on 23-Jun-2020 11:36:24

478 Views

Protected access specifier allows a child class to access the member variables and member functions of its base class. This way it helps in implementing inheritance. We will discuss this in more details in the inheritance chapter.The following is an example showing we have set an protected member variable in Class A.class A {    protected int a2 = 87; }Now under the derived class when we will try to access the above variable from the derived class object, then it would work fine as shown below −Exampleusing System; class A {    protected int a2 = 87; } class ... Read More

Handle Text Overflow in JavaScript

Krantik Chavan
Updated on 23-Jun-2020 11:36:08

109 Views

Use the textOverflow property to counter the text overflow issue. Add ellipses if the text overflows the containing element.ExampleYou can try to run the following code to learn what is to be done when text overflows the containing element with JavaScript −                    #myID {             border: 2px solid blue;             background-color: gray;             overflow: hidden;             text-overflow: visible;             width: 200px;       ... Read More

Set Text Capitalization with JavaScript

Ramu Prasad
Updated on 23-Jun-2020 11:35:30

235 Views

To set the capitalization, use the textTransform property in JavaScript. Set it to capitalize, if you want the first letter of every word to be a capital letter.ExampleYou can try to run the following code to return the capitalization of a text with JavaScript −           Capitalize Text                This is demo text! This is demo text!                      function display() {             document.getElementById("myID").style.textTransform = "capitalize";          }          

C# Program to Find Maximum and Minimum Element in an Array

Ankith Reddy
Updated on 23-Jun-2020 11:35:29

7K+ Views

Set the minimum and maximum element to the first element so that you can compare all the elements.For maximum.if(arr[i]>max) {    max = arr[i]; }For minimum.if(arr[i]

HTML DOM MouseEvent offsetX Property

AmitDiwan
Updated on 23-Jun-2020 11:35:15

636 Views

The HTML DO MouseEvent offsetX property returns the horizontal (x) coordinate of the mouse pointer relative to the target element if a mouse event was triggered. Use with offsetY to get the vertical coordinate as well.Following is the syntax −Returning reference to the offsetX objectMouseEventObject.offsetXLet us see an example of MouseEvent offsetX property −Example Live Demo MouseEvent offsetX    * {       padding: 2px;       margin:5px;    }    form {       width:70%;       margin: 0 auto;       text-align: center;    }    #outer {       width:70%;   ... Read More

Advertisements