Browse by Tags

Related Posts

  • Upgrading all projects to .NET 3.5

    A simple macro to change the Target Framework for a project from .NET 2.0 to .NET 3.5, hacked together in a few minutes. This will fail for C++/CLI projects, and possibly VB.NET projects (haven't checked). Works fine for regular C# projects, as well as web projects:   For Each proj As Project In...
    Posted to Miscellaneous Debris (Weblog) by Avner Kashtan on 05-25-2008, 12:00 AM
    Filed under: .NET, CodeSnippets, Visual Studio, C#, C++/CLI
  • System.Diagnostics.EventLogEntry and the non-equal Equals.

    Just a quick heads-up in case you're stumped with this problem, or just passing by: The System.Diagnostics.EventLogEntry class implements the Equals method to check if two entries are identical, even if they're not the same instance. However, contrary to best practices, it does NOT overload the operator...
    Posted to Miscellaneous Debris (Weblog) by Avner Kashtan on 11-25-2007, 12:00 AM
    Filed under: .NET, CodeSnippets, C#
  • Displaying live log file contents

    I'm writing some benchmarking code, which involves a Console application calling a COM+ hosted process and measuring performance. I want to constantly display results on my active console, but since some of my code is running out-of-process, I can't really write directly to the console from all parts...
    Posted to Miscellaneous Debris (Weblog) by Avner Kashtan on 11-21-2007, 12:00 AM
    Filed under: .NET, CodeSnippets, C#
  • Dynamically creating a Sharepoint Web-Service proxy instance

    In my current code, I find myself accessing many Sharepoint web services. In one run of code I can access 5-6 different web services on dozens of different sites, not necessarily even on the same server. Given that I find myself writing a lot of boilerplate code looking like this: using (SiteData siteDataWS...
    Posted to Miscellaneous Debris (Weblog) by Avner Kashtan on 09-03-2007, 12:00 AM
    Filed under: .NET, SharePoint, CodeSnippets, C#, Generics
  • Allowing timeout on long-running operations - possible bug

    A while ago, I wrote about a simple pattern to allow us to put a timeout limitation on a long running operations. Simply put, it allows us to replace this: public MyObject GetData() { try { MyObject data = BigComponent.LongRunningOperation(); return data; } catch (Exception ex) { // Log and rethrow....
    Posted to Miscellaneous Debris (Weblog) by Avner Kashtan on 08-27-2007, 12:00 AM
    Filed under: .NET, CodeSnippets, C#
  • Retrieving all properties for a Sharepoint list

    When we call the GetListItems or GetListItemChanges methods in Sharepoint's Lists Web Service, we pass an XmlNode parameter specifying which fields we want to return, in this format: <ViewFields> <FieldRef Name="ows_ID"/> </ViewFields> Now, if we leave this field as null , we get a...
    Posted to Miscellaneous Debris (Weblog) by Avner Kashtan on 06-03-2007, 12:00 AM
    Filed under: .NET, SharePoint, CodeSnippets, C#
  • Granting User Rights in C#

    As a follow-up to my previous post about changing a Windows Service's user account - there was one think I forgot. In order for a user to run a service, that user must be granted the "Run as Service" right by the operating system. Usually it's not a problem - the Services MMC snap-in automatically adds...
    Posted to Miscellaneous Debris (Weblog) by Avner Kashtan on 05-10-2007, 12:00 AM
    Filed under: .NET, CodeSnippets, C#, WMI
  • Setting Windows Service Account - C# and WMI

    I've been busting my brains for over two hours trying to accomplish a relatively simple task - changing the username and password of a currently running Windows Service. Should be trivial enough, but the managed ServiceController class doesn't give me that ability, so I had to resort to more esoteric...
    Posted to Miscellaneous Debris (Weblog) by Avner Kashtan on 05-08-2007, 12:00 AM
    Filed under: .NET, CodeSnippets, C#, WMI
  • Preventing Outlook from closing with Alt-F4

    I have come to the realization, at some point, that I never want to close Outlook. Really, there's no reason for me to shut it down except when doing something special, like freeing every available byte of memory, or when developing add-ins to it. During day-to-day work, I always want it on and minimized...
    Posted to Miscellaneous Debris (Weblog) by Avner Kashtan on 04-14-2007, 12:00 AM
    Filed under: .NET, Office, CodeSnippets, C#
  • Reflecting over an Event

    A coworker (Hey, Evgeny!) came to me with a puzzler today. He has an object that exposes an event, and he wants to know whether he's already subscribed to that event. Two things immediately came to mind - the first was that he really shouldn't be doing that, and the second was to suggest that...
    Posted to Miscellaneous Debris (Weblog) by Avner Kashtan on 03-29-2007, 12:00 AM
    Filed under: .NET, CodeSnippets, Reflection, C#
Page 1 of 2 (15 items) 1 2 Next >
Microsoft Communities