Click here to Skip to main content
15,902,114 members
Home / Discussions / C#
   

C#

 
GeneralRe: Getting information about an object hosted on a different application Pin
dimaj12-Jun-08 5:37
dimaj12-Jun-08 5:37 
AnswerRe: Getting information about an object hosted on a different application Pin
Christian Graus11-Jun-08 7:35
protectorChristian Graus11-Jun-08 7:35 
GeneralRe: Getting information about an object hosted on a different application Pin
dimaj11-Jun-08 7:41
dimaj11-Jun-08 7:41 
GeneralRe: Getting information about an object hosted on a different application Pin
Christian Graus11-Jun-08 8:25
protectorChristian Graus11-Jun-08 8:25 
GeneralRe: Getting information about an object hosted on a different application Pin
Christian Graus11-Jun-08 8:25
protectorChristian Graus11-Jun-08 8:25 
GeneralRe: Getting information about an object hosted on a different application Pin
dimaj11-Jun-08 8:29
dimaj11-Jun-08 8:29 
QuestionA field initializer cannot reference the non-static field, method or property... help with code snippet Pin
ssclaire11-Jun-08 6:45
ssclaire11-Jun-08 6:45 
AnswerRe: A field initializer cannot reference the non-static field, method or property... help with code snippet Pin
S. Senthil Kumar11-Jun-08 6:56
S. Senthil Kumar11-Jun-08 6:56 
Your code works probably because you moved initialization of colorValues inside Main. Your original code probaly initialized them as part of the field declaration, like
class Program
{
   Array colorValues = Enum.GetValues(typeof(ColorType));
   Polygon[] allPolygons = new Polygon[colorValues.Length * shapeValues.Length];
}


That doesn't work - instance field initializers cannot refer to other instance field initializers. That means that you cannot refer to colorValues from any other instance field initializer.

The typical solution is to move the initialization code to the constructor of the class.

Regards
Senthil [MVP - Visual C#]
_____________________________
My Blog | My Articles | My Flickr | WinMacro

GeneralRe: A field initializer cannot reference the non-static field, method or property... help with code snippet Pin
ssclaire11-Jun-08 8:35
ssclaire11-Jun-08 8:35 
AnswerSome Progress... Update Pin
ssclaire11-Jun-08 7:08
ssclaire11-Jun-08 7:08 
GeneralRe: Some Progress... Update Pin
Christian Graus11-Jun-08 7:19
protectorChristian Graus11-Jun-08 7:19 
GeneralRe: Some Progress... Update Pin
S. Senthil Kumar11-Jun-08 8:27
S. Senthil Kumar11-Jun-08 8:27 
AnswerRe: A field initializer cannot reference the non-static field, method or property... help with code snippet Pin
Christian Graus11-Jun-08 7:08
protectorChristian Graus11-Jun-08 7:08 
QuestionCompiler Error Message: CS1519: Invalid token 'foreach' in class, struct, or interface member declaration Pin
Marvin A. Lee II11-Jun-08 6:17
Marvin A. Lee II11-Jun-08 6:17 
AnswerRe: Compiler Error Message: CS1519: Invalid token 'foreach' in class, struct, or interface member declaration Pin
leppie11-Jun-08 6:21
leppie11-Jun-08 6:21 
GeneralRe: Compiler Error Message: CS1519: Invalid token 'foreach' in class, struct, or interface member declaration Pin
Marvin A. Lee II11-Jun-08 11:51
Marvin A. Lee II11-Jun-08 11:51 
AnswerRe: Compiler Error Message: CS1519: Invalid token 'foreach' in class, struct, or interface member declaration Pin
S. Senthil Kumar11-Jun-08 6:22
S. Senthil Kumar11-Jun-08 6:22 
AnswerRe: Compiler Error Message: CS1519: Invalid token 'foreach' in class, struct, or interface member declaration Pin
leppie11-Jun-08 6:23
leppie11-Jun-08 6:23 
QuestionCode Generation competition Article Submission problem. Pin
hdv21211-Jun-08 6:06
hdv21211-Jun-08 6:06 
AnswerRe: Code Generation competition Article Submission problem. Pin
leppie11-Jun-08 6:19
leppie11-Jun-08 6:19 
GeneralRe: Code Generation competition Article Submission problem. Pin
hdv21211-Jun-08 6:23
hdv21211-Jun-08 6:23 
GeneralRe: Code Generation competition Article Submission problem. Pin
leppie11-Jun-08 6:25
leppie11-Jun-08 6:25 
AnswerRe: Code Generation competition Article Submission problem. Pin
Giorgi Dalakishvili11-Jun-08 6:58
mentorGiorgi Dalakishvili11-Jun-08 6:58 
QuestionShould I use new for a string? [Solved] Pin
Hamed Musavi11-Jun-08 5:59
Hamed Musavi11-Jun-08 5:59 
AnswerRe: Should I use new for a string? Pin
leppie11-Jun-08 6:06
leppie11-Jun-08 6:06 

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.