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

C#

 
QuestionStoring Huge volume of data for processing... Pin
amatbrewer31-Jan-07 8:38
amatbrewer31-Jan-07 8:38 
AnswerRe: Storing Huge volume of data for processing... Pin
Colin Angus Mackay31-Jan-07 9:06
Colin Angus Mackay31-Jan-07 9:06 
GeneralRe: Storing Huge volume of data for processing... Pin
Dan Neely31-Jan-07 9:09
Dan Neely31-Jan-07 9:09 
AnswerIf the data is one off Pin
Ennis Ray Lynch, Jr.31-Jan-07 9:55
Ennis Ray Lynch, Jr.31-Jan-07 9:55 
GeneralRe: If the data is one off Pin
amatbrewer31-Jan-07 11:00
amatbrewer31-Jan-07 11:00 
GeneralRe: If the data is one off Pin
Ennis Ray Lynch, Jr.31-Jan-07 16:04
Ennis Ray Lynch, Jr.31-Jan-07 16:04 
Questionwhat is Inf Pin
netJP12L31-Jan-07 8:19
netJP12L31-Jan-07 8:19 
AnswerRe: what is Inf Pin
Pete O'Hanlon31-Jan-07 8:49
mvePete O'Hanlon31-Jan-07 8:49 
If you want to define multiple items that must be implemented in a class to guarantee an operation, then use an interface. This means that you can refer to the class that instantiates it without needing to know what the class is. As an example, suppose that you have developed a database agnostic application and you want to read a DataReader, then you could do this:

public class AgnosticReaderImplementation
{
  public void Fill(IDataReader dr)
  {
    while (dr.HasRows)
    {
      ...
    }
  }
}


This way, the code outside your class could pass in a SqlDataReader, or an OracleDataReader and so on.

An abstract class is normally the base for something else, so it defines the basics (or common options) for your implementations. It is a relatively high-level abstraction that you must inherit from to do something useful. Consider this very trivial example.

public abstract IdBase
{
  private string _id = string.Empty;
  protected object lockObject = new Object();
  private bool _isDirty = false;
  public Id
  {
    get 
    {
      lock (lockObject)
      {
        return _id;
      }
    }
    set
    {
      lock (lockObject)
      {
        Changed(_id, value);
        _id = value;
      }
    }
  }
  private void Changed(object old, object change)
  {
    if (old != null && !old.Equals(change))
      isDirty = true;
  }
  public bool IsDirty
  {
    get { 
      lock (lockObject)
      {
        return _isDirty ;
      }
    set {
      lock (lockObject)
      {
        _isDirty = true;
      }
    }
  }
}

public class DatabaseHandler : IdBase
{
}


This means that in the class DatabaseHandler there certain items that have already been applied by virtue of being in the class IdBase. You can't instantiate IdBase directly, because it isn't really very useful on its own, but it does give you a good base for using in other classes.

Implementing things as static means that you don't have to instantiate a class to call a method. This is useful, for instance, when you want to do something like writing to a log. Suppose that you have a class called Utility which implements a static method WriteToLog, then all you have to do in your code is call Utility.WriteToLog to call it.


the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer

Deja View - the feeling that you've seen this post before.

AnswerRe: what is Inf Pin
Guffa31-Jan-07 9:03
Guffa31-Jan-07 9:03 
Questioncategory for beginners? Pin
Ranger4931-Jan-07 7:58
Ranger4931-Jan-07 7:58 
AnswerRe: category for beginners? Pin
Luc Pattyn31-Jan-07 8:13
sitebuilderLuc Pattyn31-Jan-07 8:13 
GeneralRe: category for beginners? Pin
Ranger4931-Jan-07 8:30
Ranger4931-Jan-07 8:30 
GeneralRe: category for beginners? Pin
Pete O'Hanlon31-Jan-07 8:51
mvePete O'Hanlon31-Jan-07 8:51 
GeneralRe: category for beginners? Pin
Luc Pattyn31-Jan-07 9:15
sitebuilderLuc Pattyn31-Jan-07 9:15 
GeneralRe: category for beginners? Pin
Colin Angus Mackay31-Jan-07 9:19
Colin Angus Mackay31-Jan-07 9:19 
GeneralRe: category for beginners? Pin
Ranger4931-Jan-07 9:31
Ranger4931-Jan-07 9:31 
GeneralRe: category for beginners? Pin
Pete O'Hanlon31-Jan-07 9:42
mvePete O'Hanlon31-Jan-07 9:42 
GeneralRe: category for beginners? Pin
Luc Pattyn31-Jan-07 11:35
sitebuilderLuc Pattyn31-Jan-07 11:35 
GeneralRe: category for beginners? Pin
Colin Angus Mackay31-Jan-07 11:31
Colin Angus Mackay31-Jan-07 11:31 
GeneralRe: category for beginners? Pin
Christian Graus31-Jan-07 14:53
protectorChristian Graus31-Jan-07 14:53 
GeneralRe: category for beginners? Pin
Ranger4931-Jan-07 16:37
Ranger4931-Jan-07 16:37 
AnswerRe: category for beginners? Pin
ednrgc1-Feb-07 3:45
ednrgc1-Feb-07 3:45 
QuestionWhy doesn't this work? Pin
Ranger4931-Jan-07 7:36
Ranger4931-Jan-07 7:36 
AnswerRe: Why doesn't this work? Pin
Luc Pattyn31-Jan-07 7:58
sitebuilderLuc Pattyn31-Jan-07 7:58 
AnswerRe: Why doesn't this work? Pin
Patrick Etc.31-Jan-07 8:59
Patrick Etc.31-Jan-07 8:59 

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.