Thursday, February 7, 2013

UML introduction

The four of the most common diagrams

  • Class diagram
  • Object diagram
  • Sequence diagram
  • Package diagram 
It is not methodology. It is, on the other hand, a precise diagramming notation that will allow program designs to be represented and discussed. As it is graphical in nature it becomes easy to visualize  understand and discuss the information presented in the diagram. However , as the diagrams represent technical information they must be precise and clear- in order for them to work- therefore there is a precise notation that must be followed.

UML Class Diagram:

A class name consists of -
  • a unique name (conventionally starting with an uppercase letter)
  • a list of attributes (int,double,boolean,String etc)
  • a list of methods

________________________________
                      Class name
________________________________
                      Attributes
________________________________
                     Methods()
________________________________

Attibutes and Methods visibility modifier are shown as 
+  public
-  private
#  protected
~ package



A class diagrams can make use of keywords, notes and comments.
A class diagram can show the following information:-


  • Classes

- attributes
- operations
- visibility

  • Relationships

- navigability
- multiplicity
- dependency
- aggregation
- composition

  • Generalization/specialization

- inheritance
- interfaces

  • Keywords


  • Notes and Comments











1.What is Dependency ?

2. What is Simple Association?

3. What is Bidirectional Association?

4. What is Aggregation?





5. What is Composition?

Inheritance.







Deffered Execution



An important feature of many query operatops is that they execute not when constructed, but when enumerated (in other words, when MoveNext is called on the enumerator). Consider the following
query.

var numbers = new List<int>{1};
numbers.Add(1);
IEnumerable<int> query = numbers.Select(n=>n*10);
numbers.Add(2);

foreach(int n in query)
Console.Write(n+"|"); //10|20|


This is called differed or lazy evaluation.


The following conversion operators:
             ToArray, ToList, ToDictionary, ToLookup

The Conversion operators are useful, in part , because they defeat lazy evaluation. This can be useful when:

You want to "freeze" or cache the results at a certain point in time.

you want to avoid re-executing a computationally intensive query, or a query with a remote data source such as a LINQ  to SQL table. ( A side effect of lazy evaluation in that the query gets re-evaluated should you later re-enumerate it).

The following example illustrates the ToList operator:

var number = new List<int>(){1,2};

List<int> timesTen = numbers
.Select(n=>n*10)
.ToList(); //Executes immediately into a List<int>
number.Clear();
Console.WriteLine (timesTen.Count); // still 2


Tuesday, February 5, 2013

Function Techniques in C# : Currying


Named after Mathematician Haskell Curry.
Although it really was Schonfinkel who came up with the idea.

Syntax
Func<T1,TResult>
Func<int,int>

Example:1


void Main()
{
Func<string,string,int> str = (x,y)=>x.Length  + y.Length ;
str("google","plus");
}


Example:2


 static int Calculate(Func<int, int, int> op, int a, int b)
 {
        return op(a, b);
  }
  static void Main(string[] args)
  {
        int three = Calculate((x, y) => x + y, 1, 2);
        int eight = Calculate((l, r) => l * r, 2, 4);
  }

Example:3

DataTable newDataTable = new DataTable("filteredTable");
        Func<DataTable, String[], DataRow, DataRow> NewRow = delegate(DataTable targetTable, String[] columns, DataRow srcRow)
        {
            if (targetTable == null)
                throw new ArgumentNullException("targetTable");
            if (columns == null)
                throw new ArgumentNullException("columns");
            if (srcRow == null) throw new ArgumentNullException("srcRow");

            if (columns.Count() == 0) throw new ArgumentNullException("srcRow");

            DataRow row = targetTable.NewRow();

            foreach (var column in columns)
            {
                if (!targetTable.Columns.Contains(column))
                    targetTable.Columns.Add(column);

                row[column] = srcRow[column];
            }


            return row;
        };

        var query = (from d in _MyDataset.Tables["Records"].AsEnumerable()
                     where d.Field<String>("Name").Equals("searchText", StringComparison.CurrentCultureIgnoreCase)
                     select NewRow(newDataTable, new[] { "Value" }, d));

        if (query.Count() != 0) { DataTable result = query.CopyToDataTable(); }


Friday, February 1, 2013

SharpDevelp


Developing Dot Net project??
Yes we usually use Visual Studio IDE. Instead there is one more IDE which is
Open source and named as SharpDevelop . 

It supports C#, console,ASP.NET,Windows.

Download::
http://www.icsharpcode.net/opensource/sd/download/

Code Formater

Paste Here Your Source Code
Source Code Formatting Options
1) Convert Tab into Space :
2) Need Line Code Numbering :
3) Remove blank lines :
4) Embeded styles / Stylesheet :
5) Code Block Width :
6) Code Block Height :
7) Alternative Background :
Copy Formatted Source Code
 
Preview Of Formatted Code