Array.IsFixedSize Property is used to get a get a value indicating whether the Array has a fixed size. This property implements the IList.IsFixedSize
Property .
Syntax:
public bool IsFixedSize { get; }
Property Value: This property is always return true for all arrays.
Below programs illustrate the use of above-discussed property:
Example 1:
// C# program to illustrate // IsFixedSize of Array class using System; namespace techfortech { class TECH { // Main Method public static void Main() { // declares an 1D Array of string string[] topic; // allocating memory for topic. topic = new string[] {"Array, ", "String, ", "Stack, ", "Queue, ", "Exception, ", "Operators"}; // Displaying Elements of the array Console.WriteLine("Topic of C#:"); foreach(string ele in topic) Console.WriteLine(ele + " "); Console.WriteLine(); // Here we check whether is // array of fixed size or not Console.WriteLine("Result: " + topic.IsFixedSize); } } }
Output:
Topic of C#: Array, String, Stack, Queue, Exception, Operators Result: True
Example 2:
// C# program to illustrate // IsFixedSize of Array class using System; namespace techfortech { class TECH { // Main Method public static void Main() { // declares a 1D Array of string // and assigning null to it string[] str = new string[] {null}; // Here we check whether is // array of fixed size or not Console.WriteLine("Result: " + str.IsFixedSize); } } }
Output:
Result: True
Recent Comments