.netRelated issues-Collection of common programming errors
Joey Adams
c# .net
Such as int, long, ushort, uint, short, etc.Why isn’t there a short hand for System.DateTime?
Simon Svensson
c# .net visual-studio-2010 linq visual-studio-2012
Somehow following code doesn’t compile in VS2010 but compiles in VS2012 without changes. The problematic line in VS2010 is names.Select(foo.GetName)error CS1928: ‘string[]’ does not contain a definition for ‘Select’ and the best extension method overload ‘System.Linq.Enumerable.Select<TSource,TResult>(System.Collections.Generic.IEnumerable<TSource>, System.Func<TSource,TResult>)’ has some invalid arguments.using System; using System.Linq;namespace ConsoleApplication1 {class Pro
Jim Mischel
.net timer
Note that I’m asking about something that will call a callback function more often than once every 15 ms using something like System.Threading.Timer. I’m not asking about how to accurately time a piece of code using something like System.Diagnostics.Stopwatch or even QueryPerformanceCounter.Also, I’ve read the related questions:http://stackoverflow.com/questions/448761/accurate-windows-timer-system-timers-timer-is-limited-to-15-msechttp://stackoverflow.com/questions/163022/high-resolution-timer
Bill the Lizard
c# .net out-of-memory
Why does this:class OutOfMemoryTest02 {static void Main(){string value = new string(‘a’, int.MaxValue);} }Throw the exception; but this wont:class OutOfMemoryTest {private static void Main(){Int64 i = 0;ArrayList l = new ArrayList();while (true){l.Add(new String(‘c’, 1024));i++;}} }Whats the difference?
Clafou
.net localization internationalization datetime-format pseudolocalization
My computer is configured with a culture that is not en-US. When using the native Win32 GetDateFormat function, i get correctly formatted dates:22//11//2011 4::42::53 P?~M]This is correct; and is also how Windows renders it:the taskbarRegion and Language settingsWindows ExplorerOutlookWhen i try to convert a date to a string in .NET using my current locale, e.g.:DateTime.Now.ToString(); DateTime.Now.ToString(CultureInfo.CurrentCulture);i get an incorrect date:22////11////2011 4::::42::::53 P?~M]
Kos L.A.
.net winforms nunit-2.5
First of all, sorry for my english since it’s not my native language.Problem was happened in my .NET Windows Forms Application and reproduced only on Virtaul PC Windows 7 (x64) for some reasons. I faced with Win32Exception in one place of my application when resizing main application form containing a lot of custom controls, including two stacked to each other tabcontrols etc… Exception’s message was “Error creating window handle”. Spending some time I found solution for that problem on Micro
Robert P
c# .net winapi watin screenshot
I’m currently working with WatiN, and finding it to be a great web browsing automation tool. However, as of the last release, it’s screen capturing functionality seems to be lacking. I’ve come up with a workable solution for capturing screenshots from the screen (independently generating code similar to this StackOverflow question) in addition to some code by Charles Petzold. Unfortunately, there is a missing component: Where is the actual window?WatiN conveniently provides the browser’s hWnd
Grand Avenue Software
c# .net authentication active-directory .net-4.5
In testing our .NET 4.0 application under .NET 4.5, we’ve encountered a problem with the FindByIdentity method for UserPrincipal. The following code works when run in a .NET 4.0 runtime, but fails under .NET 4.5:[Test] public void TestIsAccountLockedOut() {const string activeDirectoryServer = “MyActiveDirectoryServer”;const string activeDirectoryLogin = “MyADAccount@MyDomain”;const string activeDirectoryPassword = “MyADAccountPassword”;const string userAccountToTest = “TestUser@MyDomain”;const
user2668128
c# asp.net .net asp.net-web-api
I have created a basic ASP.NET Web Api Application inside VS Express 2013 using all of the defaults. I added a controller and it returns XML just as I want.As soon as I install the CORS package:Install-Package Microsoft.AspNet.WebApi.Cors -PreI can’t even run the application anymore:An exception of type ‘System.IO.FileLoadException’ occurred in mscorlib.dll and wasn’t handled before a managed/native boundaryAdditional information: Could not load file or assembly ‘System.Web.Http, Version=5.0.0.0
HeavenCore
c# .net vb.net visual-studio
Take the following class:Public Class DocumentNumberPrivate m_DOC_NUMBER As Integer = 0Public Sub New(ByVal DOC_NUMBER As Integer)m_DOC_NUMBER = DOC_NUMBEREnd SubPublic Sub New(ByVal DEPOT_CODE As String)Dim ParseInput As Integer = 0If Integer.TryParse(DEPOT_CODE, ParseInput) = False Thenm_DOC_NUMBER = 0Elsem_DOC_NUMBER = ParseInputEnd IfEnd Sub”’ <summary>”’ Returns the DOC_NUMBER as a zero-padded number, eg: 0000028374”’ </summary>Public Overrides Function ToString() As StringRe
Web site is in building