Detecting Net Framework directory
You can use
System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory()
or
HttpRuntime.ClrInstallDirectory property ( don’t forget to add reference to System.Web.dll )
Random thoughts about .Net development
You can use
System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory()
or
HttpRuntime.ClrInstallDirectory property ( don’t forget to add reference to System.Web.dll )
The following function creates an Engine object and uses the BuildProject method to build a project file.
scriptParams )
{
// Instantiate a new Engine object
Engine engine = new Engine();
// Point to the path that contains the .NET Framework 2.0 CLR and tools
engine.BinPath =
System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory();
// Instantiate a new FileLogger to generate build log
FileLogger logger = new FileLogger();
// Set the logfile parameter to indicate the log destination
logger.Parameters = "logfile="+logPath;
// Register the logger with the engine
engine.RegisterLogger(logger);
Project project = new Project(engine);
project.Load(msbuildScriptPath);
// pass params to msbuild file
foreach (BuildPropertyGroup pg in project.PropertyGroups)
{
foreach ( string key in scriptParams.Keys )
{
pg.AddNewProperty( key, scriptParams[key]);
}
break;
}
// Build a project file
bool success = engine.BuildProject(project);
//Unregister all loggers to close the log file
engine.UnregisterAllLoggers();
return success;
}
Most online resources talks about how to document class methods and properties .In this post I’m going to show how to comment your datasets to create professional and more convenient documentation .
Take a look at picture below.
To achieve such results, organize your XML tags in this way
<summary>
[Method Sumamry]
</summary>
<value>
The dataset contains the following tables
<remarks>
<list type="table">
<listheader>
<term>Table</term>
</listheader>
<item>
<term>[Table Name]</term>
</item>
</list>
</remarks>
Table [Table Name] contains the following fields:
<remarks>
<list type="table">
<listheader>
<term>Field</term>
<description>Description</description>
</listheader>
<item>
<term>[Column Name]</term>
<description>[Column Description]</description>
</item>
</list>
</remarks>
</value>
The Comment snippet below, along with NDoc produced the MSDN-style formatted document.
/// <summary>
/// Gets the history entries.
/// </summary>
/// <value>
/// The dataset contains the following tables
/// <remarks>
/// <list type="table">
/// <listheader>
/// <term>Table</term>
/// </listheader>
/// <item>
/// <term>History</term>
/// </item>
/// </list>
/// </remarks>
///
///
/// Table History contains the following fields:
/// <remarks>
/// <list type="table">
/// <listheader>
/// <term>Field</term>
/// <description>Description</description>
/// </listheader>
/// <item>
/// <term>Method (<see cref="System.String"/>)</term>
/// <description>Method name</description>
/// </item>
/// <item>
/// <term>ExecutedTime (<see cref="System.DateTime"/>)</term>
/// <description>When the specific method was executed</description>
/// </item>
/// <item>
/// <term>Result (<see cref="System.float"/>)</term>
/// <description>Method result</description>
/// </item>
/// </list>
/// </remarks>
/// </value>
Technorati Tags: Programming Net DataSet System.Data Document CHM
.NET supports Unicode and you can use variables and literals in your own language.Is it useful? I don’t know ,but looks amazing.
using System;
namespace Devintelligence.Localization
{
/// <summary>
/// Localization in Hebrew
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
for( int ????? = 0;?????<10;?????++ )
{
Console.Write("{0}", ????? );
}
Console.ReadLine();
}
}
}
[Via Abhinaba's blog]
Add this declaration.
[DllImport("user32")]
public static extern short GetKeyState (Keys VirtKey);
On your KeyDown event, you can check which shift key has been pressed down in this way:
bool LShiftPressed = ((GetKeyState(Keys.LShiftKey) & 256)==256);
bool RShiftPressed = ((GetKeyState(Keys.RShiftKey) & 256)==256);