How to link your own XSD file to your XML file

XSD File:

<?xml version=”1.0″ encoding=”utf-8″?>

<xs:schema targetNamespace=”<Some String as namespace>”     elementFormDefault=”qualified”    xmlns:xs=”<some schema defn may be from w3>” >




XML File:

<?xml version=”1.0″ encoding=”utf-8″ ?>

<Rootelement xmlns=”<same targetNamespace as in xsd file>” xmlns:xsi=”<some schema defn may be from w3>” xsi:schemaLocation=”<same targetNamespace as in xsd file><space><xsd file name.xsd>” >





How to run a exe file and get the output of the exe using a C# project:


using System.Diagnostics.Process;


Process process = new Process();

process.StartInfo.UseShellExecute = false;

process.StartInfo.RedirectStandardOutput = true;

process.StartInfo.FileName = process.Start();

string output = process.StandardOutput.ReadToEnd();


Console.WriteLine(string.Format(“Result is {0}”, output));


Attribute Class

Language: C#


using System;


public class <AttributeName> : Attribute


public <AttributeName>(String Name) //if no named parameter is there no need of this constructor




public string Name { get; set; } //Named Parameter i.e it is compulsory

public string[] stringarray{ get; set; } // Optional Parameter



public class <class name>


//Class Definition goes here


[<Attributename>(“xyz”,stringarray = new string[] {“Hi” , “Hello” })]

public class <class name1>


//Class Definition goes here


public class <class name2>


System.Attribute[] attrs =   System.Attribute.GetCustomAttributes(typeof(<classname1>));

foreach (System.Attribute attribute in attrs)


if (attribute is <AttributeName>)


<AttributeName> e = (<AttributeName>)attribute;






Dynamically loading a dll and invoking a method in it

Language: C#

Source Code:

// Adding assembly referenece dynamically

Assembly addassembly = Assembly.LoadFrom(<path>);

foreach (Type type in addassembly.GetTypes())


// If it is class it will go into the “if” structure

if (type.IsClass == true)


// the class must have extended an interface which has the method name that you want to invoke, this ensures the presence of the method that you want to invoke in the

if (type.GetInterface(<Inteface_name>) == null)




object obj = Activator.CreateInstance(type);

// Invokes the method

object result = type.InvokeMember(<method_name>, BindingFlags.InvokeMethod | BindingFlags.Default, null, obj, null);



How to create a DLL and How to Debug it

1. Create a “Class library Project” in Visual Studio.

2. Complete the project.

3. Build the project. Dll will be created in the bin\debug  folder of your project.

4. Create a new Test project (Console Application) to test the project.

5. Add the project to the current solution.

6. Set the “Test Project” as the “Startup Project”.

7. Now Debug it.

Type or Namespace not found. Are you missing the assembly reference ? – Solution

Name: Type or Namespace not found. Are you missing the assembly reference ?

Software : Visual Studio


1. Check whether you have added the reference to the Namespace in the solution explorer. If not , add it.

2. Check whether the proper version of the dll file is added as a reference.

3. Still error persists ?? then Add the corresponsing project refernence and check.

4. If this doesnt work, check your Target Framework, whether the project you are referencing and you are using has the same target framework.

I Hope this will solve the problem.