Browsing 7239 questions and answers with Jon Skeet
Why format is different in different machine for same culture? Because formats are updated over time, in different OS releases and in patches/hotfixes. .NET is fetching the format from the OS (I believe, anyway), so it's the OS that's... more 7/18/2017 8:55:16 AM
string[] is convertible to object, so this line: string actual = (string) action.DynamicInvoke(args); ... is invoking the delegate with two arguments. You want this: string actual = (string) action.DynamicInvoke((object) args); ...... more 7/17/2017 4:31:59 PM
There's nothing you could do for this in a "normal" way, but there's one option you could consider... If you give your CreatureBehavior class just a private constructor, then nest PlayerBehavior and NonPlayerBehavior within that class,... more 7/16/2017 7:18:26 PM
If all the array elements will be the same type, or if they're different types but in a way that satifies type inference, you can use an implicitly typed array - like var but for arrays, basically: if (new[] { "a", "b", "b"... more 7/15/2017 7:53:48 AM
Like many LINQ operations, Zip is lazy - your lambda expression is never being executed, because you're calling Zip but never using the results. If you changed your test to do something like: var list = All.Zip(...).ToList(); Then I... more 7/14/2017 1:37:59 PM
The time zone IDs you've given are the ones from the IANA time zone database, aka TZDB (aka Olson, aka tz). They're not supported by .NET (although .NET Core running on Linux/Mac will probably do what you want). My Noda Time project does... more 7/14/2017 6:20:01 AM
The result of the first cast is a different value. It's now a byte not a char. The second cast is a reference conversion. The result is the same set of bits - a reference to the same object - just with a different compile-time type.... more 7/13/2017 10:31:42 AM
You need to quote the solution filename because it has spaces in: compiler.StartInfo.Arguments = link + @"""C:\Users\khan\Documents\Visual Studio 2012\Projects\Calculator\Calculator.sln"" /t:build /r:System.dll /out:sample.exe... more 7/12/2017 10:47:40 AM
You're using the "old style" msbuild project, which won't work with the dotnet CLI. Replace your whole project file with: <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> ... more 7/11/2017 2:00:38 PM
The params keyword of C# allows equivalence between Array and parameter-list, does it not? When the C# (or VB) compiler is involved, yes. Not when you're using reflection. The problem is that you're invoking the delegate dynamically... more 7/11/2017 10:51:16 AM