Beruflich Dokumente
Kultur Dokumente
(A) What are different types of Assembly? There are two types of
assembly Private and Public assembly.A private assembly is
normally used by a single application, and is stored in the
application's directory, or a sub-directory beneath. A shared
assembly is normally stored in the global assembly cache, which
is a repository of assemblies maintained by the .NET runtime.
Shared assemblies are usually libraries of code which many
applications
.NET Framework’s Reflection API allows you to fetch Type (Assembly) information at
runtime programmatically. We can also achieve the late binding by using .NET
Reflection. At runtime, Reflection mechanism uses the PE file to read the information
about the assembly. Reflection enables you to use code that was not available at
compile time..NET Reflection allows application to collect information about itself and
also manipulate on itself. It can be used effectively to find all the types in an
assembly and/or dynamically invoke methods in an assembly. This includes
information about the type, properties, methods and events of an object. With
reflection we can dynamically create an instance of a type, bind the type to an
existing object, or get the type from an existing object and invoke its methods or
access its fields and properties. We can also access attribute information using
reflection.
(C) What is Difference between NameSpace and Assembly?
1. Start Microsoft Visual Studio .NET, Microsoft Visual Studio 2005, or Microsoft Visual C# 2005 Express
Edition.
2. Create a new Visual C# Windows Application project named ThreadWinApp.
3. Add a Button control to the form. By default, the button is named Button1.
4. Add a ProgressBar component to the form. By default, the progress bar is namedProgressBar1.
5. Right-click the form, and then click View Code.
6. Add the following statement to the beginning of the file:
using System.Threading;
Note This is the code that underlies the thread. This code is an infinite loop that randomly increments
or decrements the value in ProgressBar1, and then waits 100 milliseconds before it continues.
34. Add the following Load event handler for Form1. This code creates a new thread, makes the thread a
background thread, and then starts the thread.
35. private void Form1_Load(object sender, System.EventArgs e)
36. {
37. Thread trd = new Thread(new ThreadStart(this.ThreadTask));
38. trd.IsBackground = true;
39. trd.Start();
}
Back to the top
1. Build and run the application. Notice that the value in ProgressBar1 changes randomly. This is the
new thread in operation.
2. To demonstrate that the main thread is independent of the thread that changes the value
of ProgressBar1, click the button on the form. You receive a dialog box with the following error
message: