How do you apply a .net attribute to a return type
How do I apply the MarshalAsAttribute to the return type of the code below? public ISomething Foo() { return new MyFoo(); } ...
How do I apply the MarshalAsAttribute to the return type of the code below? public ISomething Foo() { return new MyFoo(); } ...
Now this is .NET but I am sure the principal should apply to all OOP language, to simplify I take .NET as an example: R# usually creator constructor and passing incoming variable to private field, which for me mi tend to pass it to Property. Any opinion on how the different and what is the best practice for that? ...
I have a windows application and I want to save the size, position and WindowState between sessions. There is one caveat however. If the state when closing is minimized then I want to restore to the last visible state, i.e. Normal if it was normal before being minimized or maximized if it was maximized. Is there a property, check, cal...
I wrote some code with a lot of recursion, that takes quite a bit of time to complete. Whenever I "pause" the run to look at what's going on I get: Cannot evaluate expression because the code of the current method is optimized. I think I understand what that means. However, what puzzles me is that after I hit step, the cod...
Hi, I have heard mention that some desktop applications are pretty much just wrappers for websites now. I have even had the occasional problem that has been best solved this way in the past and I can see it being really useful for current applications development. However, one problem I always seemed to run into was that the Web Site ...
how do i read a time value and then insert it into TimeSpan variables ...
See the question. I want to see the methods and classes offered by a DLLs library. ...
I have used visual studio for a long time, but one feature I have never used is the Macro system. I saw a post where someone mentioned he used macros (no elaboration) so I was wondering is it really worth the time investing in learning how to create macros? If so what kind of stuff do you make? There was similar post(s), but i am try...
I'm connecting to a web service hosted by a third-party provider. I've added a service reference in my project to the web service, VS has generated all the references and classes needed. I'm connecting with this piece of code (client name and methods anonymized): using (var client = new Client()) { try { client.Ope...
We want migrate from Delphi 7.0 to Delphi 2009, to stay up with a modern IDE and current technology. Our target platform is .NET. What is best way, to achieve this goal? ...
How would I invert .NET regex matches? I want to extract only the matched text, e.g. I want to extract all IMG tags from an HTML file, but only the image tags. ...
I'm creating a UI that allows the user the select a date range, and tick or un-tick the days of the week that apply within the date range. The date range controls are DateTimePickers, and the Days of the Week are CheckBoxes Here's a mock-up of the UI: From Date: (dtpDateFrom) To Date: (dtpDateTo) [y] Monday, [n] Tuesday, [y] We...
I have a .NET application which has different configuration files for Debug and Release builds. E.g. the debug app.config file points to a development SQL Server which has debugging enabled and the release target points to the live SQL Server. There are also other settings, some of which are different in debug/release. I currently use t...
I have found that when I execute the show() method for a contextmenustrip (a right click menu), if the position is outside that of the form it belongs to, it shows up on the taskbar also. I am trying to create a right click menu for when clicking on the notifyicon, but as the menu hovers above the system tray and not inside the form (as...
Here's the scenario: You have a Windows server that users remotely connect to via RDP. You want your program (which runs as a service) to know who is currently connected. This may or may not include an interactive console session. Please note that this is the not the same as just retrieving the current interactive user. I'm guessing t...
I haven't worked on a .NET project for a while (more than a year). Before I've never used an ORM for a .NET application. What are some of your takes on this? Does using one make sense? Which ones should I consider trying? ...
The ThreadStatic attribute declares a static variable as unique-per-thread. Do you know an easy pattern to correctly dispose such variables? What we used before ThreadStatic is a ThreadContextManager. Every thread was allocated a ThreadContext which retained all thread-specific information. We spawned some threads and let them work. The...
I am trying to make an Outlook 2003 add-in using Visual Studio 2008 on Windows XP SP3 and Internet Explorer 7. My add-in is using custom Folder Home Page which displays my custom form, which wraps Outlook View Control. I get COM Exception with 'Exception from HRESULT: 0xXXXXXXXX' description every time when I try to set Folder property...
I would like to code a little program which visually illustrates the behavior of the 'volatile' keyword. Ideally, it should be a program which performs concurrent access to a non volatile static field and which get incorrect behavior because of that. Adding the volatile keyword in the same program should fix the problem. That somethin...
When trying to call Close or Dispose on an SqlDataReader i get a timeout expired exception. If you have a DbConnection to SQL Server, you can reproduce it yourself with: String CRLF = "\r\n"; String sql = "SELECT * " + CRLF + "FROM (" + CRLF + " SELECT (a.Number * 256) + b.Number AS Number" + CRLF + " FROM master..spt_v...