• Generic method

    The following code shows some example of generic method

    //the T can be inferred from the type of input parameter
    public static T DoByInferType<t>(T input)
    {
        return default(T);
    }
    
    
  • Using user style sheet to modify the style of a web site

    I tried to modify the style by using user style sheet. But some of style just could not take effect. I seemingly forget the basic rule of css cascade. The cascade works in the following order of importance:

  • Function.createDelegate

    function greet(message) {
            alert(message + ", " + this.name);
        }
    
    
  • Function.createCallback

       var createCallback = function(method, context) {
        return function() {
            //the arguements is passed in when the this callback
            //method is call
            //if there is parameter passed
            //package the parameter with the context
            //into an array, an invoke the callback
            //method with the array
            var l = arguments.length;
            if (l > 0) {
                var args = [];
                for (var i = 0; i < l; i++) {
                    args[i] = arguments[i];
                }
                //the last array member is the 
                //the context
                args[l] = context;
    
    
  • Create a SharePoint Solution

    SharePoint use solution file to deploy solution. There are some tools to create a solution file automatically, like stsdev. But it still important to understand how the solution deployment works