Disable/Enable Checkbox with jQuery

Kristi Castro
Updated on 20-Jun-2020 15:45:00

6K+ Views

fTo disable and enable checkbox, use the attr() method.Initially set the input type checkbox and disable it −MaleNow on the click of a button, toggle between disabled and enabled checkbox −$("#button1").click(function() {    $("#sName").attr('disabled', !$("#sName").attr('disabled')); });Example Live Demo jQuery Example               $(document).ready(function() {          $("#button1").click(function() {             $("#sName").attr('disabled', !$("#sName").attr('disabled'));          });       });     Male

Pass Parameters to a Method in C#

karthikeya Boyini
Updated on 20-Jun-2020 15:40:16

271 Views

To pass parameters to a method in C#, let us see how to pass parameters by value. In this mechanism, when a method is called, a new storage location is created for each value parameter.The values of the actual parameters are copied into them. Hence, the changes made to the parameter inside the method have no effect on the argument.Here is the example showing how to pass parameters to a method −Example Live Demousing System; namespace Demo {    class NumberManipulator {       public void swap(int x, int y) {          int temp;     ... Read More

Pass Pointers as Parameters to Methods in C#

Samual Sam
Updated on 20-Jun-2020 15:39:11

2K+ Views

To pass pointers as parameters to methods, refer the below steps −Firstly, crate a function swap with unsafe modifier.public unsafe void swap(int* p, int *q) {    int temp = *p;    *p = *q;    *q = temp; }Now under static void main, add the value for the first and second variable, set pointers for both of them.Display the values of the variables and then call the swap() method shown above. The method swaps the values and displays the result −public unsafe static void Main() {    Program p = new Program();    int var1 = 10;    int ... Read More

What are Pointers in C#

Arjun Thakur
Updated on 20-Jun-2020 15:38:39

6K+ Views

Pointer is a variable whose value is the address of another variable i.e., the direct address of the memory location.The syntax of a pointer is −type *var-name;The following is how you can declare a pointer type −double *z; /* pointer to a double */C# allows using pointer variables in a function of code block when it is marked by the unsafe modifier. The unsafe code or the unmanaged code is a code block that uses a pointer variable.The following is our module showing how to declare and use a pointer variable. We have used unsafe modifier here −static unsafe void ... Read More

Method Overloading in C#

karthikeya Boyini
Updated on 20-Jun-2020 15:38:14

2K+ Views

Two or more than two methods having the same name but different parameters is what we call method overloading in C#.Method overloading in C# can be performed by changing the number of arguments and the data type of the arguments.Let’s say you have a function that prints multiplication of numbers, then our overloaded methods will have the same name but different number of arguments −public static int mulDisplay(int one, int two) { } public static int mulDisplay(int one, int two, int three) { } public static int mulDisplay(int one, int two, int three, int four) { }The following is an ... Read More

Write in Order with For Loop or While Loop

Arnab Chakraborty
Updated on 20-Jun-2020 15:34:17

285 Views

Example#include #include void main() {    int i,j,a=0,b=1,n;    clrscr();    printf("****************OUTPUT*****************");    printf("enter the value of n : ");    scanf("%d",&n);    printf(" the required order is: " );    for(i=1;i

Main Parts of a C Hash Program

Samual Sam
Updated on 20-Jun-2020 15:32:32

2K+ Views

The main parts of a C# program includes −Namespace declarationA classClass methodsClass attributesA Main methodStatements and ExpressionsCommentsThe following is an example showing how to create a C# program −Example Live Demousing System; namespace Demo {    class Program {       static void Main(string[] args) {          Console.WriteLine("Our first program in C#!");          Console.ReadKey();       }    } }OutputOur first program in C#!Here are the parts of the C# program we saw above −using System; - the using keyword is used to include the System namespace in the program. A program ... Read More

Methods and Properties of the Thread Class in C#

George John
Updated on 20-Jun-2020 15:31:04

546 Views

Threads are lightweight processes. One common example of use of thread is implementation of concurrent programming by modern operating systems.The following are some of the properties of the Thread class −Sr.No.Property & Description1CurrentContextGets the current context in which the thread is executing.2CurrentCultureGets or sets the culture for the current thread.3CurrentPrincipleGets or sets the thread's current principal (for role-based security).4CurrentThreadGets the currently running thread.5CurrentUICultureGets or sets the current culture used by the Resource Manager to look up culture-specific resources at run-time.6ExecutionContextGets an ExecutionContext object that contains information about the various contexts of the current thread.7IsAliveGets a value indicating the execution status ... Read More

Item Property of BitArray Class in C#

karthikeya Boyini
Updated on 20-Jun-2020 15:30:41

127 Views

The Item property of the BitArray class gets or sets the value of the bit at a specific position in the BitArray.Use the keyword to define the indexers instead of implementing the Item property. To access an element, use the mycollection[index].The following is the implementation of BitArray class Item property −Example Live Demousing System; using System.Collections; class Demo {    static void Main() {       bool[] arr = new bool[5];       arr[0] = true;       arr[1] = true;       arr[2] = false;       arr[3] = false;       BitArray ... Read More

Use Chash BinaryWriter Class in C#

Samual Sam
Updated on 20-Jun-2020 15:29:26

215 Views

If you want to write binary information into the stream, then use the BinaryWriter class in C#. You can find it under the System.IO namespace.The following is the implementation of the BinaryWriter class −static void WriteMe() {    using (BinaryWriter w = new BinaryWriter(File.Open("C:\abc.txt", FileMode.Create))) {       w.Write(37.8);       w.Write("test”);    } } static void ReadMe() {    using (BinaryReader r = new BinaryReader(File.Open("C:\abc.txt", FileMode.Open))) {       Console.WriteLine("Value : " + r.ReadDouble());       Console.WriteLine("Value : " + r.ReadString());    } }Above, theBinaryWriter class opens a file and writes content into it ... Read More

Advertisements