h1.post-title { color:orange; font-family:verdana,Arial; font-weight:bold; padding-bottom:5px; text-shadow:#64665b 0px 1px 1px; font-size:32px; } -->

Pages

Use Proper Casing for Members

IdentifierCasingExample
Class, StructPascalStrategyManager
InterfacePascal with I prefixIStrategy
EnumerationPascalLoggingLevel
Enumeration ValuePascalInfo
Enumeration Representing Bit FieldPascal in plural SearchOptions
EventPascalClick
Private FieldCamel with underscore_scheduler
Protected FieldCamel with underscore _scheduler
Constant FieldPascalPi
Constant VariableCameldefinitionKey
Readonly FieldCamel with underscore_listItems
Static Readonly FieldPascalListValues
VariableCamelvalue
MethodPascalComputeValue
PropertyPascalValue
ParameterCamelparameter
Type ParameterPascal with T prefixTValue
NamespacePascalSystem.Drawing
Abbreviation with 2 and less lettersAll Caps UI, IO
Abbreviation with 3 and more lettersPascal Xml, Http
Use Proper Class Layout
Use the following order to position all your members inside the class. The resulting layout is the combination of all the lists provided with descending priority. That means that on the top of the file there will be all public const fields followed by internal const fields.
1.     Fields
2.     Delegates
3.     Events
4.     Properties
5.     Indexers
6.     Constructors
7.     Finalizers
8.     Methods
9.     Other stuff
Than follow access modifier.
1.     public
2.     internal
3.     protected
4.     private
After access modifier follow the type of the member.
1.     const
2.     static
3.     readonly
4.     nothing
The least significant sorting attribute is a declaration modifier.
1.     virtual
2.     abstract
3.     override
4.     new

XSLT Elements

                     The links in the "Element" column point to attributes and more useful information about each specific element.


Element
Description
Applies a template rule from an imported style sheet
Applies a template rule to the current element or to the current element's child nodes
Adds an attribute
Defines a named set of attributes
Calls a named template
Used in conjunction with <when> and <otherwise> to express multiple conditional tests
Creates a comment node in the result tree
Creates a copy of the current node (without child nodes and attributes)
Creates a copy of the current node (with child nodes and attributes)
Defines the characters and symbols to be used when converting numbers into strings, with the format-number() function
Creates an element node in the output document
Specifies an alternate code to run if the processor does not support an XSLT element
Loops through each node in a specified node set
Contains a template that will be applied only if a specified condition is true
Imports the contents of one style sheet into another. Note: An imported style sheet has lower precedence than the importing style sheet
Includes the contents of one style sheet into another. Note: An included style sheet has the same precedence as the including style sheet
Declares a named key that can be used in the style sheet with the key() function
Writes a message to the output (used to report errors)
Replaces a namespace in the style sheet to a different namespace in the output
Determines the integer position of the current node and formats a number
Specifies a default action for the <choose> element
Defines the format of the output document
Declares a local or global parameter
Defines the elements for which white space should be preserved
Writes a processing instruction to the output
Sorts the output
Defines the elements for which white space should be removed
Defines the root element of a style sheet
Rules to apply when a specified node is matched
Writes literal text to the output
Defines the root element of a style sheet
Extracts the value of a selected node
Declares a local or global variable
Specifies an action for the <choose> element
Defines the value of a parameter to be passed into a template

Define Lambda Expression

Lambda Expression is a function without a name the calculates and returns single value.
Lambda Expression uses to lambda operator => [Goes To].
Syntax:
Inut Parameter) => Expression
Example:
Add Two TestBox into Form.
TxtInput and TxtOutput.
string[] arrName ={"Lakshmi",,"Narayaanan","Sriram","Suresh","Sravan","Srinath"};

Convert int? to int in C#.net

Convert int? to int in C#.net
int? v1;
int v2;
if(v1.HasValue)
v2=v1.Value

App Config File in C#.net

Read Setting Method
public static string ReadSetting(string key)
{
return ConfigurationSettings.AppSettings[key];
}
Write Setting Method
public static void WriteSetting(string key, string value)
{
XmlDocument doc = LoadConfigDocument();
XmlNode node = doc.SelectSingleNode("//appSettings");
if (node == null)
throw new InvalidOperationException("appSettings section not found in config file.");
try
{
XmlElement elem = (XmlElement)node.SelectSingleNode(string.Format("//add[@key='{0}']", key));
if (elem != null)
{
elem.SetAttribute("value", value);
}
else
{
elem = doc.CreateElement("add");
elem.SetAttribute("key", key);
elem.SetAttribute("value", value);
node.AppendChild(elem);
}
doc.Save(GetConfigFilePath());
}
catch
{
throw;
}
}
Remove Setting Method
public static void RemoveSetting(string key)
{
XmlDocument doc = LoadConfigDocument();
XmlNode node = doc.SelectSingleNode("//appSettings");
try
{
if (node == null)
throw new InvalidOperationException("appSettings section not found in config file.");
else
{
node.RemoveChild(node.SelectSingleNode(string.Format("//add[@key='{0}']", key)));
doc.Save(GetConfigFilePath());
}
}
catch (NullReferenceException e)
{
throw new Exception(string.Format("The key {0} does not exist.", key), e);
}
}
Load Config Document Method
private static XmlDocument LoadConfigDocument()
{
XmlDocument doc = null;
try
{
doc = new XmlDocument();
doc.Load(GetConfigFilePath());
return doc;
}
catch (System.IO.FileNotFoundException e)
{ throw new Exception("No configuration file found.", e);
}
}
Get Config FilePath Method
private static string GetConfigFilePath()
{
return Assembly.GetExecutingAssembly().Location + ".config";
}


Display ODD or Even using LINQ in C#.net

This is the C# Code for Find display Odd or Even Number using LINQ .
var numbers = from n in Enumerable.Range(1,25)
select new {number = n,OddEven =n %2 ==1? "odd","Even"};
foreach(var n in mubers)
{
listbox1.items.add("The Number is" ,+n.number +n.OddEven);
}

Define Dynamic Resource

The resource that are referred by using the DynamicResources markup extension are knows as Dynamic Resource.

Define Static Resource

The resource that are referred by using the staticResources markup extension are knows as static Resource.

Define XBAPs

  •     XBAPs Stands for XAML Browser  application.
  •     It is a Webserver hosted WPF applications that run in a web browser.
  •     It consists of several pages ,which uses can nativate through in the browser.


Designing Pattern

Designing Pattern

  1. Creational Patterns
  2. Strucutural Patterns
  3. Behavioral Patterns

1. Creational Patterns:
Abtaract Factory:
 Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
Builder Patterns:
 Separate the construction of a complex object from its representation so that the same construction process can create different representations.
Factory Method:
 Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.
Prototype Patterns:
 Specify the kind of objects to create using a prototypical instance, and create new objects by copying this prototype.
Singleton Patterns:
   Ensure a class has only one instance and provide a global point of access to it.
2. Strucutural Patterns
Adapter :
  Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn't otherwise because of incompatible interfaces.
Bridge :
   Decouple an abstraction from its implementation so that the two can vary independently.
Composite:
 Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly.
Decorate:
   Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.
facade:
  Provide a unified interface to a set of interfaces in a subsystem. Façade defines a higher-level interface that makes the subsystem easier to use.
Flyweight:
  Use sharing to support large numbers of fine-grained objects efficiently.
Proxy:
 Provide a surrogate or placeholder for another object to control access to it.
3.Behavioral Patterns
Chain of Responibility:
 Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it.
Command:
 Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations.
Interpreter:
  Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language.
Iterator:
     Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.
Mediator:
 Define an object that encapsulates how a set of objects interact. Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independent.
Memento:
 Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored to this state later.
Observe:
    Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
State:
 Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.
Strategy:
 Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
Template Method:
 Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure.
Visitor:
  Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates.