
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
What is the IsReadOnly property of BitArray class in C#?
The BitArray class is used when you need to store the bits but do not know the number of bits in advance.
Using the IsReadOnly class, you can get a value indicating whether the BitArray is read-only or not. ReadOnly will not allow you to add new elements to the BitArray.
The following is our example stating how to use the IsReadOnly property of BitArray class in C#.
Example
using System; using System.Collections; namespace Demo { class Program { static void Main(string[] args) { BitArray ba1 = new BitArray(5); BitArray ba2 = new BitArray(5); byte[] a = { 90 }; byte[] b = { 30 }; ba1 = new BitArray(a); ba2 = new BitArray(b); Console.WriteLine("Bit array ba1: 60"); for (int i = 0; i < ba1.Count; i++) { Console.Write("{0, -4} ", ba1[i]); } Console.WriteLine(); Console.WriteLine("IsReadOnly = " + ba1.IsReadOnly); Console.WriteLine("IsReadOnly = " + ba2.IsReadOnly); Console.ReadKey(); } } }
Output
Bit array ba1: 60 False True False True True False True False IsReadOnly = False IsReadOnly = False
- Related Articles
- What is the IsReadOnly property of Hashtable class in C#?
- What is the IsReadOnly property of SortedList class in C#?
- What is the IsReadOnly property of ArrayList class in C#?
- What is the Count property of BitArray class in C#?
- What is the Item property of BitArray class in C#?
- What is the Length property of BitArray class in C#?
- What is the BitArray class in C#?
- BitArray Class in C#
- What is the Count property of ArrayList class in C#?
- What is the Capacity property of SortedList class in C#?
- What is the Count property of Hashtable class in C#?
- What is the Count property of Queue class in C#?
- What is the Count property of Stack class in C#?
- What is the Count property of SortedList class in C#?
- What is the Values property of Hashtable class in C#?

Advertisements