Click here to Skip to main content
15,895,606 members
Home / Discussions / C#
   

C#

 
QuestionHttpWebRequest performance and keep-alive Pin
pattyweb7-Sep-07 13:47
pattyweb7-Sep-07 13:47 
AnswerRe: HttpWebRequest performance and keep-alive Pin
Scott Dorman7-Sep-07 13:54
professionalScott Dorman7-Sep-07 13:54 
QuestionNeed help with panels and forms? Pin
DogMa3x7-Sep-07 12:28
DogMa3x7-Sep-07 12:28 
AnswerRe: Need help with panels and forms? Pin
Skippums10-Sep-07 3:52
Skippums10-Sep-07 3:52 
QuestionRichTextBox DragDrop [modified] Pin
Skippums7-Sep-07 11:37
Skippums7-Sep-07 11:37 
AnswerRe: RichTextBox DragDrop Pin
Dave Kreskowiak7-Sep-07 13:04
mveDave Kreskowiak7-Sep-07 13:04 
QuestionRichTextBox DragDrop Pin
Skippums10-Sep-07 3:40
Skippums10-Sep-07 3:40 
QuestionOverriding ReadOnlyCollection and "Late Population" of the list Pin
J.G.Cda7-Sep-07 11:06
J.G.Cda7-Sep-07 11:06 
I have several collections derived from ReadOnlyCollection<t>.

For reasons of time and resource management, I don't want to automatically populate the underlying lists unless the collection or one of its properties/methods is actually accessed by some code.

This I accomplish by replacing each method of the ReadOnlyCollection with a "new" method in the derived class whose code first runs a private "loader" method (which loads the collection items), and then returns the base class' value.

Example:

public class MyCollection : ReadOnlyCollection<thing> {

public MyCollection : base( new List<thing>() ) {
}

public new int Count {
get { Load();
return base.Count; }

private void Load() {
// Go to the data source and populate the collection in here
// if it hasn't already been loaded
}

}


It works fine if I work with the derived class.

The problem is that when I assign the class as a DataSource to a windows form control, it doesn't work correctly. The reason is that the control is working directly with the "IList" properties/methods, and so doesn't use replacement code in the derived class.

The correct technique would be to "override" the properties/methods (instead of "new"), but that doesn't work because the ReadOnlyCollection base class doesn't define them as virtual.

Has anyone else worked around this?

Thanks in advance
Jon
QuestionHierarchical hyperlink hype Pin
Istvan4047-Sep-07 10:55
Istvan4047-Sep-07 10:55 
QuestionData Grid View Calculations Pin
jasper0187-Sep-07 10:54
jasper0187-Sep-07 10:54 
AnswerRe: Data Grid View Calculations Pin
Giorgi Dalakishvili7-Sep-07 11:06
mentorGiorgi Dalakishvili7-Sep-07 11:06 
GeneralRe: Data Grid View Calculations Pin
jasper01810-Sep-07 7:20
jasper01810-Sep-07 7:20 
Questioncalculate subitems Pin
andredani7-Sep-07 10:44
andredani7-Sep-07 10:44 
AnswerRe: calculate subitems Pin
Giorgi Dalakishvili7-Sep-07 11:11
mentorGiorgi Dalakishvili7-Sep-07 11:11 
GeneralRe: calculate subitems Pin
andredani7-Sep-07 11:16
andredani7-Sep-07 11:16 
AnswerRe: calculate subitems Pin
Skippums7-Sep-07 11:44
Skippums7-Sep-07 11:44 
GeneralRe: calculate subitems Pin
andredani7-Sep-07 11:52
andredani7-Sep-07 11:52 
GeneralRe: calculate subitems Pin
Guffa7-Sep-07 12:01
Guffa7-Sep-07 12:01 
GeneralRe: calculate subitems Pin
ChrisKo7-Sep-07 12:01
ChrisKo7-Sep-07 12:01 
GeneralRe: calculate subitems Pin
andredani7-Sep-07 12:17
andredani7-Sep-07 12:17 
GeneralRe: calculate subitems Pin
ChrisKo7-Sep-07 12:53
ChrisKo7-Sep-07 12:53 
GeneralRe: calculate subitems [modified] Pin
andredani7-Sep-07 13:10
andredani7-Sep-07 13:10 
GeneralRe: calculate subitems Pin
Skippums10-Sep-07 3:29
Skippums10-Sep-07 3:29 
Questiondatagrid selected rows loop Pin
jnallen7-Sep-07 6:12
jnallen7-Sep-07 6:12 
AnswerRe: datagrid selected rows loop Pin
Christian Graus7-Sep-07 6:22
protectorChristian Graus7-Sep-07 6:22 

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.