Click here to Skip to main content
16,004,727 members
Home / Discussions / C#
   

C#

 
AnswerRe: how to display checkbox in listbox Pin
freshonlineMax20-Sep-06 23:05
freshonlineMax20-Sep-06 23:05 
GeneralRe: how to display checkbox in listbox Pin
CM Makwana18-Feb-09 4:56
CM Makwana18-Feb-09 4:56 
QuestionOracleClient Connection String Pin
M Riaz Bashir20-Sep-06 21:01
M Riaz Bashir20-Sep-06 21:01 
AnswerRe: OracleClient Connection String Pin
Robert Rohde20-Sep-06 21:02
Robert Rohde20-Sep-06 21:02 
Questionhi everybody! Pin
e-laj20-Sep-06 20:52
e-laj20-Sep-06 20:52 
AnswerRe: hi everybody! Pin
Christian Graus20-Sep-06 21:34
protectorChristian Graus20-Sep-06 21:34 
GeneralRe: hi everybody! Pin
Rob Manderson19-Jul-08 23:47
protectorRob Manderson19-Jul-08 23:47 
AnswerRe: hi everybody! Pin
Guffa20-Sep-06 21:50
Guffa20-Sep-06 21:50 
There is no way of making an object dynamically read-only wihtout logic in the class.

An alternative could be to make a wrapper class that only exposes the contents from the class as read-only. Example:

public class MyClassReader {

   private MyClass _daClass;

   public MyClassReader(MyClass daClass) {
      _daClass = daClass;
   }

   public int SomeProperty { get { return _daClass.SomeProperty; } }
   public string SomeOtherProperty { get { return _daClass.SomeOtherProperty; } }

}


Another alternative could be to make the properties virtual and make a class that inherits from MyClass and overrides the properties and throws an exception if the set accessor is used.

A bit of code in both cases, but both these alternatives has the advantage that it leaves the original MyClass unchanged (or mostly unchanged) and unaware of all the fuss.


---
b { font-weight: normal; }

Questionc# mdi form application focus change problem Pin
orfur@orfur.com20-Sep-06 20:06
orfur@orfur.com20-Sep-06 20:06 
QuestionPrinter Is Print Slowly And Stoped....C# Pin
galigal1520-Sep-06 19:10
galigal1520-Sep-06 19:10 
AnswerRe: Printer Is Print Slowly And Stoped....C# Pin
Syed Mujtaba Hassan22-Sep-06 23:19
Syed Mujtaba Hassan22-Sep-06 23:19 
GeneralRe: Printer Is Print Slowly And Stoped....C# Pin
galigal1523-Sep-06 12:10
galigal1523-Sep-06 12:10 
GeneralRe: Printer Is Print Slowly And Stoped....C# Pin
Syed Mujtaba Hassan25-Sep-06 0:18
Syed Mujtaba Hassan25-Sep-06 0:18 
GeneralRe: Printer Is Print Slowly And Stoped....C# Pin
galigal1525-Sep-06 1:32
galigal1525-Sep-06 1:32 
GeneralRe: Printer Is Print Slowly And Stoped....C# Pin
Syed Mujtaba Hassan25-Sep-06 19:02
Syed Mujtaba Hassan25-Sep-06 19:02 
GeneralRe: Printer Is Print Slowly And Stoped....C# Pin
galigal1526-Sep-06 1:46
galigal1526-Sep-06 1:46 
GeneralRe: Printer Is Print Slowly And Stoped....C# Pin
Syed Mujtaba Hassan27-Sep-06 22:58
Syed Mujtaba Hassan27-Sep-06 22:58 
QuestionPrinter Is Print Slowly And Stoped...... Pin
galigal1520-Sep-06 19:07
galigal1520-Sep-06 19:07 
Questionhow to recognise thread Pin
Parshant Verma20-Sep-06 18:57
Parshant Verma20-Sep-06 18:57 
AnswerRe: how to recognise thread Pin
S. Senthil Kumar20-Sep-06 20:07
S. Senthil Kumar20-Sep-06 20:07 
QuestionFew qustions Pin
NaNg1524120-Sep-06 18:08
NaNg1524120-Sep-06 18:08 
AnswerRe: Few qustions Pin
yueue20-Sep-06 19:00
yueue20-Sep-06 19:00 
GeneralRe: Few qustions Pin
NaNg1524121-Sep-06 7:23
NaNg1524121-Sep-06 7:23 
QuestionWhich Control is Best To Draw Graphs? Pin
...---...20-Sep-06 16:17
...---...20-Sep-06 16:17 
AnswerRe: Which Control is Best To Draw Graphs? Pin
Christian Graus20-Sep-06 16:44
protectorChristian Graus20-Sep-06 16:44 

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.