C#

  • Limit C# Windows Application to single instance

private bool PreviousInstance()
{
return ( System.Diagnostics.Process.GetProcessesByName(
System.Diagnostics.Process.GetCurrentProcess().ProcessName ).Length > 1 );
}

  • Getting the Screen Size in WPF

System.Windows.SystemParameters.PrimaryScreenWidth;
System.Windows.SystemParameters.PrimaryScreenHeight;

  • Embed Mozilla Firefox in .Net apps

Gecko for C# : http://geckofx.org/

  • merge a native dll and a managed dll

http://sqlite.phxsoftware.com/

  • Compile time scripting

MSBuild : http://msdn.microsoft.com/en-us/library/0k6kkbsd.aspx

  • Drop shadow in WPF

<Grid>

        <Rectangle
         Width="Auto"
         Height="Auto"
         Stroke="#10000000"
         StrokeThickness="1"/>
        <Rectangle
         Width="Auto"
         Height="Auto"
         Stroke="#5C000000"
         StrokeThickness="1" Margin="1" />
        <Rectangle
         Width="Auto"
         Height="Auto"
         Stroke="#AC000000"
         StrokeThickness="1" Margin="2" />
        <Rectangle
         Width="Auto"
         Height="Auto"
         Fill="Transparent"
         Stroke="#FF000000"
         StrokeThickness="1" Margin="3">
        </Rectangle>
        <Grid Margin="3" Background="White">
            Contents go here!
        </Grid>
    </Grid>
 
  • Drop Shadow in WPF better way
add PresentationFramework.Aero to project's resources. then add this line to XAML namespace:
 xmlns:dropShadow=”clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero”
then use this to enclose the shadowed elements:
 
<dropShadow:SystemDropShadowChrome>
      <Grid x:Name=”MyElement” />
</dropShadow:SystemDropShadowChrome>