Wednesday, March 3, 2010

About CSharp

CSharp Tools

There are nice tools to optimize your work:
  • ReSharper
  • .Net managed (plug-in for ReSharper) resources StyleCop
  • .Net managed assemblies FxCop
  • Reflector
  • GhostDoc
  • NDoc3 (for Mono)
  • NUnit (2.4.8 for mono)
  • xUnit and xUnitContrib for Resharper
  • SilverLight
  • IronPyhton 2.0.1 runtime
  • IronRuby 1.1.3 corresponding to Ruby 1.9
  • Trident Activities and workflow
  • SandCastle (for Mono DXROOT=D:\Sandcastle\;DX_PATH=%DXROOT%\ProductionTools) for help file from API (you need also HtmlHelper HTMLHELP_PATH=D:\HTML Help Workshop)
  • DPack
  • Javascript Parser
  • Jscript Brace Matching Extension
  • Jscript Editor Extensions 
  • Jscript IntelliSense Para Extension
  • Jscript Outlining Extension
  • Jscript Word Highlighter Extension 
  • Microsoft All-In-One Code Framework Sample Browser 
  • Productivity Power Tools 
  • Regex Editor 
  • Spell Checker 
  • VSColorOutput 
  • REP++
  • Web Essentials
  • Web Standards Update  

Set a CSharp class template

We always read the manual.

public class MyClass : IDisposable
{
#region AttributeMembers
#region PublicAttributes


#endregion

#region PrivateAttributes

/// Flag for disposed resources private bool _IsDisposed = false; #endregion

#region ProtectedAttributes
#endregion

#endregion

#region AttributeAccessors

#region Getters

#endregion

#region Setters

#endregion

#region Mutators

#endregion

#endregion

#region Constructors

/// Initializes a new instance of the class. public MyClass()

{ }

#endregion
#region Destructor
/// Releases unmanaged resources and performs other cleanup operations before the
/// is reclaimed by garbage collection.
/// This destructor will run only if the Dispose method does not get called.
/// It gives your base class the opportunity to finalize.
/// Do not provide destructors in types derived from this class.
~MyClass()
{
// Do not re-create Dispose clean-up code here.
// Calling Dispose(false) is optimal in terms of readability and maintainability.
Dispose(false);

}
#endregion
#region MethodMembers

#region PrivateMethods
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// true to release both managed and unmanaged resources; false to release only unmanaged resources.

private void Dispose(bool isDisposing)
{

//Check if Dispose has been called

if (!this._IsDisposed)

{//dispose managed and unmanaged resources

if (isDisposing)

{//managed resources clean

this._DestZip = this._Src2Zip = null;

this._FileZip = null;//~

}

//unmanaged resources clean


//confirm cleaning

this._IsDisposed = true;

}

}

#endregion

#region PublicMethods

/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// Do not make this method virtual, a derived class should not be able to override this method.
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
#region PublicAbstractMethods
#endregion
#region PublicOverrideMethods
#endregion
#region PublicVirtualMethods
#endregion
#endregion
#endregion
}


C# project file (.csproj)

Edit the .csproj in order to have your custom folder for your solution.
You can add them like :

<ItemGroup>
  <Folder Include="app\" />
  <Folder Include="bin\" />
  <Folder Include="data\" />
  <Folder Include="doc\" />
  <Folder Include="ext\" />
  <Folder Include="ico\" />
  <Folder Include="lib\" />
  <Folder Include="modules\" />
  <Folder Include="obj\" />
  <Folder Include="pkg\" />
  <Folder Include="script\" />
  <Folder Include="src\" />
  <Folder Include="sql\" />
  <Folder Include="temp\" />
  <Folder Include="test\" />
</ItemGroup>


RtoCSharp

We always read the manual.


After you installed R and RDCOM in windows, Add Reference to COM.
Check if you succeeded in the reference tab.
Now you can use it into code:
//use 4 COM:R(D)COM
using STATCONNECTORCLNTLib;
using StatConnectorCommonLib;
using STATCONNECTORSRVLib;

No comments:

HTMLCode

HTMLCode Content