Click here to Skip to main content
15,905,419 members
Home / Discussions / C#
   

C#

 
GeneralRe: Newbie Question Pin
Christian Graus22-Jun-08 15:12
protectorChristian Graus22-Jun-08 15:12 
GeneralRe: Newbie Question Pin
kruegersck22-Jun-08 16:28
kruegersck22-Jun-08 16:28 
GeneralRe: Newbie Question Pin
Christian Graus22-Jun-08 18:27
protectorChristian Graus22-Jun-08 18:27 
GeneralRe: Newbie Question Pin
kruegersck23-Jun-08 2:58
kruegersck23-Jun-08 2:58 
GeneralRe: Newbie Question Pin
Christian Graus23-Jun-08 11:36
protectorChristian Graus23-Jun-08 11:36 
QuestionDrog and Drop question ? Pin
Mohammad Dayyan22-Jun-08 11:17
Mohammad Dayyan22-Jun-08 11:17 
AnswerRe: Drog and Drop question ? Pin
Christian Graus22-Jun-08 12:20
protectorChristian Graus22-Jun-08 12:20 
GeneralRe: Drog and Drop question ? Pin
Mohammad Dayyan22-Jun-08 12:28
Mohammad Dayyan22-Jun-08 12:28 
GeneralRe: Drog and Drop question ? Pin
Christian Graus22-Jun-08 12:31
protectorChristian Graus22-Jun-08 12:31 
GeneralRe: Drog and Drop question ? Pin
Mohammad Dayyan22-Jun-08 12:39
Mohammad Dayyan22-Jun-08 12:39 
AnswerRe: Drog and Drop question ? Pin
Anthony Mushrow22-Jun-08 14:50
professionalAnthony Mushrow22-Jun-08 14:50 
GeneralRe: Drog and Drop question ? Pin
DaveyM6922-Jun-08 23:18
professionalDaveyM6922-Jun-08 23:18 
QuestionMaking scrol lbox custom controls using compact framework sdk Pin
neilfed222-Jun-08 9:13
neilfed222-Jun-08 9:13 
Answer[Cross Post]Re: Making scrol lbox custom controls using compact framework sdk Pin
Scott Dorman22-Jun-08 10:34
professionalScott Dorman22-Jun-08 10:34 
QuestionHelp. I'm Lost. How to retrieve the selected row information from a DataGridView Pin
TheFoZ22-Jun-08 8:04
TheFoZ22-Jun-08 8:04 
AnswerRe: Help. I'm Lost. How to retrieve the selected row information from a DataGridView Pin
User 665822-Jun-08 8:22
User 665822-Jun-08 8:22 
GeneralRe: Help. I'm Lost. How to retrieve the selected row information from a DataGridView Pin
TheFoZ22-Jun-08 8:25
TheFoZ22-Jun-08 8:25 
GeneralRe: Help. I'm Lost. How to retrieve the selected row information from a DataGridView Pin
Harvey Saayman22-Jun-08 8:56
Harvey Saayman22-Jun-08 8:56 
GeneralRe: Help. I'm Lost. How to retrieve the selected row information from a DataGridView Pin
TheFoZ22-Jun-08 9:16
TheFoZ22-Jun-08 9:16 
GeneralRe: Help. I'm Lost. How to retrieve the selected row information from a DataGridView Pin
Paul Conrad22-Jun-08 9:36
professionalPaul Conrad22-Jun-08 9:36 
QuestionHow to call base class methods automatically? Pin
Metal7622-Jun-08 7:34
Metal7622-Jun-08 7:34 
AnswerRe: How to call base class methods automatically? Pin
Scott Dorman22-Jun-08 7:50
professionalScott Dorman22-Jun-08 7:50 
Yes, it can be error-prone, but there isn't a way to automatically call the base class methods. You could implement a virtual method on Command that handles this for you and then in the derived classes override that method instead. It would make your classes look like this:
C#
public abstract class Command : Message
{
   protected byte[] CompileCommandPacketPart()
   {
   }
 
   public virtual byte[] CompilePacket()
   {
         // Compiles the generic parts of the command
         CompileCommonPacketPart();
         CompileCommandPacketPart();
   }
}
 
public class MyCommand : Command
{
   public override byte[] CompilePacket()
   {
      base.CompilePacket();
      // Adds parts specific to this command
   }
}
This simplifies things a bit in that you only have to call base.CompilePacket(). Thinking about it a bit more, you might be able to do this:
C#
public abstract class Command : Message
{
   protected byte[] CompileCommandPacketPartInternal()
   {
   }
 
   protected abstract byte[] CompileCommandPacketPart()
   {
   }
 
   protected byte[] CompilePacket()
   {
         // Compiles the generic parts of the command
         CompileCommonPacketPart();
         CompileCommandPacketPartInternal();
         CompileCommandPacketPart();
   }
}
 
public class MyCommand : Command
{
   public override byte[] CompileCommandPacketPart()
   {
      // Adds parts specific to this command
   }
This will work as long as the order of calls in Command.CompilePacket() will always be the same. In either case, you might want to make some of the protected methods internal or private instead.

Scott Dorman
Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA

[Blog][Articles][Forum Guidelines]
Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai

AnswerRe: How to call base class methods automatically? [modified] Pin
User 665822-Jun-08 8:09
User 665822-Jun-08 8:09 
AnswerRe: How to call base class methods automatically? Pin
S. Senthil Kumar22-Jun-08 10:17
S. Senthil Kumar22-Jun-08 10:17 
AnswerRe: How to call base class methods automatically? Pin
Joe Woodbury22-Jun-08 13:27
professionalJoe Woodbury22-Jun-08 13:27 

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.