Wednesday, September 28, 2011

SharePoint list to InfoPath dropdown control


How to add SharePoint column values to InfoPath dropdown control

Step 1: Tools -> Data connections
Step 2: Add a new data connection to receive data

Step 3: Select from where do you want to receive your data
             Select SharePoint Library or List   

 Step 4: Provide SharePoint site address


 Step 5: Select the list which from which you want to receive the data


 Step 6: Select the fields which are needed from the list


 Step 7:  You can store the copy of data in the form of template If needed


Step 8:Give a name for your data connection


Step 9: Select the column which you need in the drop down box

In you SharePoint site! :






Friday, September 23, 2011

.Net Interoperability


  • .Net framework supports interoperability.
  • Interoperability is the ability of two systems to communicate with each other, The first system could be built on .Net framework and the other system can be of some other technology.


.Net Interoperability is of two types:

  •  Managed code interoperability
  •  Unmanaged code interoperability

Manged code interoperability:
 Create a class library in c sharp, which has a method called Hello()



 Call the c sharp class library in VB project.



Sunday, September 18, 2011

Application of CSharp timer

We can user timers to periodically to check the server and the system is up and running

Thursday, September 15, 2011

Reflection example

Reflection is a feature in .Net which enables us to get some information about the object in runtime.That information contains data of the class.also it gets the name of the methods inside the class and constructor of the objects.
read more

Difference between Array and Array List


  • An array can contain only one data type, while array list can contain any data type in the form of object.
  • With array you cannot dynamically increase or decrease the size of the array, but array list automatically increases the size, when any element or object is added.

Wednesday, September 14, 2011

Complete list of OOP terms

When to use Interface and Abstract Class

  • Interface members cannot have a definition
  • All interface members should be implemented by the derived class
  • An abstract class can have an instance field in it. The derived classes can assess this field through the  base syntax. This is the key difference between abstract and interfaces.

Abstract class can contain non abstract method. 
When we want that all subclass must implement all methods of
base class ;In such situation use interface.In other hand
when we want only some method of base class in our subclass
then use base class as abstract class because abstract class
can contain non-abstract method.

Interfaces are used when we want classes should follow the 
rules strictly. Rules like naming coventions e.g. if in
customer class one developer add method AddCustomer other
developer while implementing Invoice class could write
method name InvoiceAdd and also could change the Signiture
rules. for addition of customer we have at client code as
Cutomer.AddCustomer(A,B,C); and Invoice.InvoiceAdd(A,B)
To maintain uniformality if we declare interface and define
method Add(A,B) in that interface and implement that
interface in both the classes then the code will be uniform
all over the classes where ever we have implemented
interface and also all concrete classes must contain
methods which are defined in the interfaces.



Interface:

–> If your child classes should all implement a certain
group of methods/functionalities but each of the child
classes is free to provide its own implementation then use
interfaces.

For e.g. if you are implementing a class hierarchy for
vehicles implement an interface called Vehicle which has
properties like Colour MaxSpeed etc. and methods like
Drive(). All child classes like Car Scooter AirPlane
SolarCar etc. should derive from this base interface but
provide a seperate implementation of the methods and
properties exposed by Vehicle.

–> If you want your child classes to implement multiple
unrelated functionalities in short multiple inheritance use
interfaces.

For e.g. if you are implementing a class called SpaceShip
that has to have functionalities from a Vehicle as well as
that from a UFO then make both Vehicle and UFO as interfaces
and then create a class SpaceShip that implements both
Vehicle and UFO .

Abstract Classes

–> When you have a requirement where your base class should
provide default implementation of certain methods whereas
other methods should be open to being overridden by child
classes use abstract classes.

For e.g. again take the example of the Vehicle class above.
If we want all classes deriving from Vehicle to implement
the Drive() method in a fixed way whereas the other methods
can be overridden by child classes. In such a scenario we
implement the Vehicle class as an abstract class with an
implementation of Drive while leave the other methods /
properties as abstract so they could be overridden by child
classes.

–> The purpose of an abstract class is to provide a common
definition of a base class that multiple derived classes can
share.

For example a class library may define an abstract class
that is used as a parameter to many of its functions and
require programmers using that library to provide their own
implementation of the class by creating a derived class.
Use an abstract class

* When creating a class library which will be widely
distributed or reused—especially to clients, use an abstract
class in preference to an interface; because, it simplifies
versioning. This is the practice used by the Microsoft team
which developed the Base Class Library. ( COM was designed
around interfaces.)

* Use an abstract class to define a common base class
for a family of types.

* Use an abstract class to provide default behavior.

* Subclass only a base class in a hierarchy to which the
class logically belongs.


Use an interface

* When creating a standalone project which can be
changed at will, use an interface in preference to an
abstract class; because, it offers more design flexibility.

* Use interfaces to introduce polymorphic behavior
without subclassing and to model multiple
inheritance—allowing a specific type to support numerous
behaviors.

* Use an interface to design a polymorphic hierarchy for
value types.

* Use an interface when an immutable contract is really
intended.

* A well-designed interface defines a very specific
range of functionality. Split up interfaces that contain
unrelated functionality.




Monday, September 12, 2011

When to use Interface

If the requirement is like that something in your design changes frequently then go for interfaces instead of classes .


                                                                                                                                                                              read more

Sharepoint integration with MS Office

Friday, September 2, 2011

C# Constants

  • Constants are immutable values which are known at the compile time.

  • They do not change for the life of the program

  • C# built in types may be declared as constants

  • User-defined types including Classes, structs , arrays cannot be 'const'

  • C # does not support const methods,properties or events

  • When a complier encounters a const identifier in c# source code, it substitutes the literal value into the intermediate language(IL) code the produces 

  • Because there is no variable address associated with a constant at run time.

  • Constant fields cannot be passed by reference 

  • Constants are marked by public,private,protected,internal.                                                                      

                                                                                                                                                    read more

What are the types of C# members

Types of C# members:


  • Fields

  • Constants

  • Properties

  • Methods

  • Constructors

  • Destructors

  • Events

  • Indexers

  • Operators

  • Nested Types