Click here to Skip to main content
15,897,371 members
Home / Discussions / C#
   

C#

 
GeneralRe: .NET load of DLL in privatePath failing -- HELP!!!! Pin
LongRange.Shooter24-Sep-04 4:40
LongRange.Shooter24-Sep-04 4:40 
GeneralRe: .NET load of DLL in privatePath failing -- HELP!!!! Pin
Heath Stewart24-Sep-04 5:36
protectorHeath Stewart24-Sep-04 5:36 
GeneralRe: Basic EventHandling Question Pin
Heath Stewart23-Sep-04 7:21
protectorHeath Stewart23-Sep-04 7:21 
GeneralRe: Basic EventHandling Question Pin
SandeepN23-Sep-04 8:49
SandeepN23-Sep-04 8:49 
GeneralRe: Basic EventHandling Question Pin
Heath Stewart23-Sep-04 10:53
protectorHeath Stewart23-Sep-04 10:53 
GeneralRe: Basic EventHandling Question Pin
SandeepN24-Sep-04 4:32
SandeepN24-Sep-04 4:32 
GeneralHowto: Lock my ArrayList collection. Pin
matthias s.23-Sep-04 6:47
matthias s.23-Sep-04 6:47 
GeneralRe: Howto: Lock my ArrayList collection. Pin
Heath Stewart23-Sep-04 7:34
protectorHeath Stewart23-Sep-04 7:34 
Extend whatever IList implementation you want (or just implement it yourself, or extend CollectionBase) and override IsReadOnly. Define a method that sets a state variable and can never set it again like so:
public class ReadOnlyArrayList
{
  bool readOnly;
  public override bool IsReadOnly
  {
    get { return readOnly; }
  }
  internal void SetReadOnly() // Or maybe public, whatever
  {
    readOnly = true;
  }
}
And there you go. Once you've filled it with the objects you want in the list, call SetReadOnly. ArrayList, along with other IList implementations in the BCL, check IsReadOnly before allowing changes using methods like Add or Remove. If you implement IList yourself, make sure you do the same.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles]
GeneralRe: Howto: Lock my ArrayList collection. Pin
Werdna23-Sep-04 10:29
Werdna23-Sep-04 10:29 
GeneralBasic EventHandling Question Pin
SandeepN23-Sep-04 6:42
SandeepN23-Sep-04 6:42 
GeneralInterfacing with C Vendor DLLs Pin
Evelyne23-Sep-04 4:53
Evelyne23-Sep-04 4:53 
GeneralRe: Interfacing with C Vendor DLLs Pin
Heath Stewart23-Sep-04 6:58
protectorHeath Stewart23-Sep-04 6:58 
GeneralRe: Interfacing with C Vendor DLLs Pin
Evelyne23-Sep-04 8:47
Evelyne23-Sep-04 8:47 
GeneralRe: Interfacing with C Vendor DLLs Pin
Heath Stewart23-Sep-04 10:17
protectorHeath Stewart23-Sep-04 10:17 
GeneralRe: Interfacing with C Vendor DLLs Pin
Evelyne24-Sep-04 16:15
Evelyne24-Sep-04 16:15 
GeneralRe: Interfacing with C Vendor DLLs Pin
Evelyne28-Sep-04 10:32
Evelyne28-Sep-04 10:32 
QuestionC# SQL data check like in PHP??? Pin
cemlouis23-Sep-04 4:44
cemlouis23-Sep-04 4:44 
AnswerRe: C# SQL data check like in PHP??? Pin
Werdna23-Sep-04 10:32
Werdna23-Sep-04 10:32 
GeneralRe: C# SQL data check like in PHP??? Pin
cemlouis23-Sep-04 11:12
cemlouis23-Sep-04 11:12 
GeneralRe: C# SQL data check like in PHP??? Pin
Werdna23-Sep-04 11:38
Werdna23-Sep-04 11:38 
GeneralRe: C# SQL data check like in PHP??? Pin
cemlouis23-Sep-04 12:20
cemlouis23-Sep-04 12:20 
Generalreading a file Pin
cmarmr23-Sep-04 3:42
cmarmr23-Sep-04 3:42 
GeneralRe: reading a file Pin
Heath Stewart23-Sep-04 6:21
protectorHeath Stewart23-Sep-04 6:21 
GeneralRe: reading a file Pin
cmarmr23-Sep-04 8:12
cmarmr23-Sep-04 8:12 
GeneralRe: reading a file Pin
StealthyMark24-Sep-04 1:16
StealthyMark24-Sep-04 1:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.