You searched for jon skeet. We found 71 results in 0.069 seconds.

UTC converted to Central Europe Standard Time is 2 hours in front not 1

I'm trying to understand why my date is wrong: DateTime databaseUtcTime = new DateTime(2016, 8, 15, 10, 20, 0, DateTimeKind.Utc); var timeZone =...
Jon Skeet
people
quotationmark

The time zone with an ID of "Central Europe Standard Time" is just the one used by central Europe... it doesn't really mean standard time. As central Europe is observing daylight savings at the moment, the offset really is UTC+2. It's... more

people

Singleton implementation laziness with static constructor

Jon Skeet suggests in his singleton implementation that if you require the maximum laziness for your singleton you should add a static constructor which will make the compiler...
Jon Skeet
people
quotationmark

When I call Singleton.Stub() the private constructor is not being hit, when I uncomment the static ctor private constuctor is always called. It's not clear what the value of which is here, but fundamentally you've got four... more

people

Check class type

How i can check if a class is of a determinated type for example: // PacketHandler.java public interface PacketHandler<T> { public void handlePacket(T packet); } //...
Jon Skeet
people
quotationmark

Unfortunately Java generics use type erasure, meaning that at execution time, any particular PacketHandler<T> is just PacketHandler as far as the VM is concerned. You may want to change your code to: public interface PacketHandler... more

people

String to Date conversion is losing time

Does anyone know why Date is losing time values when converting from String ? I cannot seem to figure this one out. Here is what type of SimpleDateFormat I am using: ...
Jon Skeet
people
quotationmark

You've specified HH in your format, which is the 24-hour format. But you've also got an AM/PM designator. As such, "03:00 PM" doesn't make sense - it's simultaneously trying to represent 3am (03 in 24 hours) and 3pm (PM in the data). It... more

people

Why a new InputStream will still read what is left over from an old InputStream?

Well please see this question and Jon Skeet's answer first. This time I have this server: public class SimpleServer { public static void main(String[] args) throws Exception...
Jon Skeet
people
quotationmark

Your client has been set up to only send 5 characters at a time, and then flush - so even though the InputStreamReader probably asked for more data than that, it received less, and then found that it could satisfy your request for 5... more

people

Why is Enumerable Min or Max inconsistent between collections of reference and value types?

When dealing with empty sequences, I was surprised to find out that the behavior for min or max is different depending on whether the source collection elements are of value type...
Jon Skeet
people
quotationmark

It's worth bearing in mind that nullable types (both nullable value types and reference types) behave differently to non-nullable value types in general when it comes to Min: a null value is treated as "missing" in general, so it's not... more

people

Multi line string literal format gives me error Input string was not in a correct format

I have the following variable: var setting = $@"worker_processes {{0}}; worker_rlimit_nofile {{1}}; error_log logs/{{2}} {{3}}; events {{ ...
Jon Skeet
people
quotationmark

It's unclear exactly what's going on as there's version confusion, but I suspect you just want: var setting = @"worker_processes {0}; worker_rlimit_nofile {1}; error_log logs/{2} {3}; events {{ ... more

people

Why static constructor not called before first call to class method

According to Jon Skeet's artice C# and beforefieldinit and discussion in When is a static constructor called in C#? static constructor must be called before first call to a method...
Jon Skeet
people
quotationmark

Your call to StaticClass.Equals is actually just a call to Object.Equals(Object, Object), as StaticClass doesn't provide an applicable overload for Equals. If you look in the IL, you'll see that the compiler has resolved the call to just... more

people

No February 30th, 1712 in .NET's Swedish calendar?

At this wonderful talk about how weirdness in real life data reflects on computer data types, Jon Skeet tells that February had 30 days in Sweden in 1712 in a weird attempt to...
Jon Skeet
people
quotationmark

Basically .NET calendar code doesn't support cutovers between the Gregorian calendar and the Julian calendar... and even if it did, I wouldn't really expect it to support the oddities of the Swedish situation, which didn't follow either of... more

people

Derived Class using Parent Method

Why can't i access the age method from either class A or B? I thought because it's a protected method, derived class instances should be able to use it? class Program { ...
Jon Skeet
people
quotationmark

Protected means it can be used from code in the derived classes - it doesn't mean it can be used "from the outside" when working with derived classes. The protected modifier can be somewhat tricky, because even a derived class can only... more

people