To generate a .dll you can following below steps
1. Right click your solution and select New Project.
2. Select Visual C# as Project type and Class Library as Templates (give proper name and location path) and click OK.
3. Write some code in the class like below, you can add as many class you want.
public class Class1
public string GetMyName(string myName)
4. Right click the Class Library project and select build.
5. Your .dll should be ready in the bin folder of the project location (either in the debug or release folder) depends on which mode your project is.
6. To refer this .dll, you can right click your project and select Add References.
7. Select browse tab from the dialogue box and choose the .dll you have just generated.
8. Now to use the method of the class library in any code behind page or another class library, you can use the namespace you had used in the class library (in above case ClassLibrary1) like "using ClassLibrary1;"
9. Instantiate the class and use its method like below
Class1 c = new Class();
string myName = c.GetMyName("Poster");
Asked In: Many Interviews |