Nullable type and a ReSharper warning?

That looks like a bug in Resharper Note, however, that that isn't thread-safe The best way to do this is to use a static initializer like this: public static LogLevel Instance { get { return Nested. Level; } } class Nested { // Explicit static constructor to tell C# compiler // not to mark type as beforefieldinit static Nested() { } internal static readonly LogLevel level = readLogLevelFromFile(); }.

That looks like a bug in Resharper. Note, however, that that isn't thread-safe. The best way to do this is to use a static initializer, like this: public static LogLevel Instance { get { return Nested.

Level; } } class Nested { // Explicit static constructor to tell C# compiler // not to mark type as beforefieldinit static Nested() { } internal static readonly LogLevel level = readLogLevelFromFile(); }.

1 that'll change when its instantiated + load it if its not used at all – eglasius May 14 '10 at 16:17 Cannot resolve symbol 'Instance'. Did you mean to do a new Nested() there? – Sarah Vessels May 14 '10 at 16:22 @Sarah: I meant .

Level.It should work now. – SLaks May 14 '10 at 16:24.

ReadLogLevelFromFile()). Value; Alternatively you can use the built in lazy type (Requires . NET 4.0 or you can roll your own.

): public static LogLevel LogLevel { get { return _logLevel. Value; } } private static Lazy _logLevel = new Lazy(readLogLevelFromFile).

That actually gives the compiler error Cannot implicitly convert type 'MyNS. LogLevel? ' to 'MyNS.

LogLevel'. An explicit conversion exists (are you missing a cast? ).

– Sarah Vessels May 14 '10 at 16:17 @Sarah - Opps, I forgot the call to Value. – ChaosPandion May 14 '10 at 16:18 That's even more compact than what I have; thanks! – Sarah Vessels May 14 '10 at 16:21.

Resharper wasn't 'smart' enough to figure it out for you. It is kind of a complex thing to figure out, I would imagine. I prefer @ChaosPandion's refactoring anyways...

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions