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
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
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
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
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
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
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
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
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
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
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP