Click here to Skip to main content
15,884,237 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to get a list of all drive letters including mapped network drives Pin
robwm113-Jan-15 5:04
robwm113-Jan-15 5:04 
GeneralRe: How to get a list of all drive letters including mapped network drives Pin
OriginalGriff13-Jan-15 5:06
mveOriginalGriff13-Jan-15 5:06 
GeneralRe: How to get a list of all drive letters including mapped network drives Pin
robwm113-Jan-15 8:25
robwm113-Jan-15 8:25 
GeneralRe: How to get a list of all drive letters including mapped network drives Pin
OriginalGriff13-Jan-15 8:37
mveOriginalGriff13-Jan-15 8:37 
QuestionHow to plot data into the graph which is receive from com port Pin
Member 1129798112-Jan-15 3:40
Member 1129798112-Jan-15 3:40 
AnswerRe: How to plot data into the graph which is receive from com port Pin
Afzaal Ahmad Zeeshan12-Jan-15 4:24
professionalAfzaal Ahmad Zeeshan12-Jan-15 4:24 
AnswerRe: How to plot data into the graph which is receive from com port Pin
V.12-Jan-15 21:12
professionalV.12-Jan-15 21:12 
QuestionStatic constructor? Pin
TMattC11-Jan-15 20:41
TMattC11-Jan-15 20:41 
Hi!
In my base class I want a "constant" FUNC_LENGTH that I assign at creation of my first object. I´d like to have it static. So I tried this:
C#
public abstract class Package
{
   private static readonly int funcLength;
   protected static int FUNC_LENGTH { get {return funcLength;} }

   static Package(int _funcLength)
   {
      funcLength = _funcLength;
   }

   public Package() {}

   ...
}


Obviously this wont work, since a static constructor wont take any parameters. Does this mean it is impossible to make FUNC_LENGTH static?
I read in a book that the static constructor is run once "before first use", does that mean it runs when (or immediately before) the first instance of the class is created?

modified 12-Jan-15 3:01am.

AnswerRe: Static constructor? Pin
V.11-Jan-15 20:52
professionalV.11-Jan-15 20:52 
GeneralRe: Static constructor? Pin
TMattC11-Jan-15 21:07
TMattC11-Jan-15 21:07 
GeneralRe: Static constructor? Pin
V.11-Jan-15 21:17
professionalV.11-Jan-15 21:17 
GeneralRe: Static constructor? Pin
OriginalGriff11-Jan-15 21:18
mveOriginalGriff11-Jan-15 21:18 
GeneralRe: Static constructor? Pin
V.11-Jan-15 21:22
professionalV.11-Jan-15 21:22 
GeneralRe: Static constructor? Pin
OriginalGriff11-Jan-15 21:27
mveOriginalGriff11-Jan-15 21:27 
AnswerRe: Static constructor? Pin
OriginalGriff11-Jan-15 21:17
mveOriginalGriff11-Jan-15 21:17 
AnswerRe: Static constructor? Pin
Dar Brett11-Jan-15 21:27
Dar Brett11-Jan-15 21:27 
GeneralRe: Static constructor? Pin
TMattC11-Jan-15 22:33
TMattC11-Jan-15 22:33 
GeneralRe: Static constructor? Pin
OriginalGriff11-Jan-15 22:58
mveOriginalGriff11-Jan-15 22:58 
GeneralRe: Static constructor? Pin
TMattC11-Jan-15 23:39
TMattC11-Jan-15 23:39 
GeneralRe: Static constructor? Pin
OriginalGriff11-Jan-15 23:46
mveOriginalGriff11-Jan-15 23:46 
GeneralRe: Static constructor? Pin
TMattC13-Jan-15 22:35
TMattC13-Jan-15 22:35 
GeneralRe: Static constructor? Pin
OriginalGriff13-Jan-15 23:04
mveOriginalGriff13-Jan-15 23:04 
GeneralRe: Static constructor? Pin
TMattC13-Jan-15 23:45
TMattC13-Jan-15 23:45 
AnswerRe: Static constructor? Pin
blachsmith16-Jan-15 15:36
blachsmith16-Jan-15 15:36 
QuestionStorm8 AutoHealer Pin
Sasz3r11-Jan-15 19:24
Sasz3r11-Jan-15 19:24 

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.