Scenario: Consider that u want to use a class but u don't know under which namespace the class belong.
Here the solution: keep the cursor on the class that u r using and press 'Alt+Shift+F10' a new popup menu will occur which will show the namespace just click on the popup menu the name space will automatically added in the starting of ur code.
Example:
using System;
Regex clsReg = new Regex(); here Regex is a class which comes under System.Text.RegularExpressions namespace but u didnt include it in ur code
now keep the cursor on Regex and press alt+shit+F10 a popup menu will occur like the below image.
then click the using System.Text.RegularExpressions;
now u go and see the starting page of ur code.
Note: This technique will workout for all the built in classes also for the classes which are added in the reference.
Automatically adding namespace
Labels: C#
IS IT POSSIBLE TO USE INNER JOIN QUERY IN A DATASET
Scenario: U have 2 tables in ur dataset with both the table contains a column name 'Samecolumn'
Table1: Samecolumn has the following 3 value
col1
col2
col3
Table2: Samecolumn has the following 2 value
col2
col3
Is it possible to query in the dataset to get the ouput of 2 rows i.e) col2, col3
Solution: No, There is no direct way to get the child rows
DataRelation and get joined rows, you will need to use the GetChildRows method of DataRow and pass the DataRelation object.
The following code example creates a DataRelation between the Customers
table and the Orders table of a DataSet and returns all the orders for each
customer.
Dim custOrderRel As DataRelation = custDataset.Relations.Add("CustOrders", _
custDS.Tables("Table1").Columns("Samecolumn"), _
custDS.Tables("Table2").Columns("Samecolumn"))
Dim custRow As DataRow
Dim orderRow As DataRow
For Each custRow in custDataset.Tables("Table1").Rows
Console.WriteLine(custRow("Samecolumn"))
For Each orderRow in custRow.GetChildRows(custOrderRel)
Console.WriteLine(orderRow("Samecolumn"))
Next
Next
Labels: C#
Find rowindex in dataset based on datarow, Set primary key to dataset
DataCoulumn[] keys = new DataColumn[1];
keys[0] = DataSet.Tables["mytable"].Column["i_ID"];
DataSet.Tables["mytable"].PrimaryKey = keys;
// To Bind in THE DATAGRID VIEW
BindingManagerBase bm;
DataGridView1.DataSource = DataSet.Tables["mytable"].DefaultView;
bm = this.DataGridView1.BindingContext[this.DataGridView1.DataSource, this. DataGridView1.DataMember];
//You have a datarow and u need to find the rowindex of the row in dataset
DataRow findRow = DataSet.Tables["mytable"].Rows.Find(((DataRowView)bm.Current).Row[0]); // Row[0] is the collumn to seach in in this case ID column
int indexNumber = DataSet.Tables["mytable"].Rows.IndexOF(findRow);
Labels: C#
Ping a machine using c#.net
try
{
Ping oping = new Ping();
PingReply oReply = oping.Send(machineipaddress);
if (oReply.Status.ToString().ToLower() != "success")
{
MessageBox.Show("Unable to ping the machine " + machineipaddress + "\n\n\t" + oReply.Status);
Environment.Exit(0);
}
}
catch (PingException ex)
{
MessageBox.Show("Error while pinging the machine " + machineipaddress + "\n\n" + ex.Message);
Environment.Exit(0);
}
Labels: C#
.net windows forms interview question
- Can you write a class without specifying namespace? Which namespace does it belong to by default??
Yes, you can, then the class belongs to global namespace which has no name. For commercial products, naturally, you wouldn't want global namespace. - You are designing a GUI application with a window and several widgets on it. The user then resizes the app window and sees a lot of grey space, while the widgets stay in place. What's the problem? One should use anchoring for correct resizing. Otherwise the default property of a widget on a form is top-left, so it stays at the same location when resized.
- How can you save the desired properties of Windows Forms application? .config files in .NET are supported through the API to allow storing and retrieving information. They are nothing more than simple XML files, sort of like what .ini files were before for Win32 apps.
- So how do you retrieve the customized properties of a .NET application from XML .config file? Initialize an instance of AppSettingsReader class. Call the GetValue method of AppSettingsReader class, passing in the name of the property and the type expected. Assign the result to the appropriate variable.
- Can you automate this process? In Visual Studio yes, use Dynamic Properties for automatic .config creation, storage and retrieval.
- My progress bar freezes up and dialog window shows blank, when an intensive background process takes over. Yes, you should've multi-threaded your GUI, with taskbar and main form being one thread, and the background process being the other.
- What's the safest way to deploy a Windows Forms app? Web deployment: the user always downloads the latest version of the code; the program runs within security sandbox, properly written app will not require additional security privileges.
- Why is it not a good idea to insert code into InitializeComponent method when working with Visual Studio? The designer will likely throw it away; most of the code inside InitializeComponent is auto-generated.
- What's the difference between WindowsDefaultLocation and WindowsDefaultBounds? WindowsDefaultLocation tells the form to start up at a location selected by OS, but with internally specified size. WindowsDefaultBounds delegates both size and starting position choices to the OS.
- What's the difference between Move and LocationChanged? Resize and SizeChanged? Both methods do the same, Move and Resize are the names adopted from VB to ease migration to C#.
- How would you create a non-rectangular window, let's say an ellipse? Create a rectangular form, set the TransparencyKey property to the same value as BackColor, which will effectively make the background of the form transparent. Then set the FormBorderStyle to FormBorderStyle.None, which will remove the contour and contents of the form.
- How do you create a separator in the Menu Designer? A hyphen '-' would do it. Also, an ampersand '&\' would underline the next letter.
- How's anchoring different from docking? Anchoring treats the component as having the absolute size and adjusts its location relative to the parent form. Docking treats the component location as absolute and disregards the component size. So if a status bar must always be at the bottom no matter what, use docking. If a button should be on the top right, but change its position with the form being resized, use anchoring.
Labels: DotNet interview Questions
Asp.net interview Questions
1. Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process. inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension),the ISAPI filter aspnet_isapi.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe.
2. What's the difference between Response.Write() andResponse.Output.Write()? The latter one allows you to write formattedoutput.
3. What methods are fired during the page load? Init() - when the pageis instantiated, Load() - when the page is loaded into server memory,PreRender() - the brief moment before the page is displayed to the user asHTML, Unload() - when page finishes loading.
4. Where does the Web page belong in the .NET Framework class hierarchy?System.Web.UI.Page
5. Where do you store the information about the user's locale? System.Web.UI.Page.Culture
6. What's the difference between Codebehind="MyCode.aspx.cs" andSrc="MyCode.aspx.cs"? CodeBehind is relevant to Visual Studio.NET only.
7. What's a bubbled event? When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.
8. Suppose you want a certain ASP.NET function executed on MouseOver overa certain button. Where do you add an event handler? It's the Attributesproperty, the Add function inside that property. So btnSubmit.Attributes.Add("onMouseOver","someClientCode();")
9. What data type does the RangeValidator control support? Integer,String and Date.
10. Explain the differences between Server-side and Client-side code? Server-side code runs on the server. Client-side code runs in the clients' browser.
11. What type of code (server or client) is found in a Code-Behind class? Server-side code.
12. Should validation (did the user enter a real date) occur server-side or client-side? Why? Client-side. This reduces an additional request to the server to validate the users input.
13. What does the "EnableViewState" property do? Why would I want it on or off? It enables the viewstate on the page. It allows the page to save the users input on a form.
14. What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other? Server.Transfer is used to post a form to another page. Response.Redirect is used to redirect the user to another page or site.
15. Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
· A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
· A DataSet is designed to work without any continuing connection to the original data source.
· Data in a DataSet is bulk-loaded, rather than being loaded on demand.
· There's no concept of cursor types in a DataSet.
· DataSets have no current record pointer You can use For Each loops to move through the data.
· You can store many edits in a DataSet, and write them to the original data source in a single operation.
· Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.
16. Can you give an example of what might be best suited to place in the Application_Start and Session_Start subroutines? This is where you can set the specific variables for the Application and Session objects.
17. If I'm developing an application that must accommodate multiple security levels though secure login and my ASP.NET web application is spanned across three web-servers (using round-robin load balancing) what would be the best approach to maintain login-in state for the users? Maintain the login state security through a database.
18. Can you explain what inheritance is and an example of when you might use it? When you want to inherit (use the functionality of) another class. Base Class Employee. A Manager class could be derived from the Employee base class.
19. Whats an assembly? Assemblies are the building blocks of the .NET framework. Overview of assemblies from MSDN
20. Describe the difference between inline and code behind. Inline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page.
21. Explain what a diffgram is, and a good use for one? The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. For reading database data to an XML file to be sent to a Web Service.
22. Whats MSIL, and why should my developers need an appreciation of it if at all? MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL.
23. Which method do you invoke on the DataAdapter control to load your generated dataset with data? The .Fill() method
24. Can you edit data in the Repeater control? No, it just reads the information from its data source
25. Which template must you provide, in order to display data in a Repeater control? ItemTemplate
26. How can you provide an alternating color scheme in a Repeater control? Use the AlternatingItemTemplate
27. What property must you set, and what method must you call in your code, in order to bind the data from some data source to the Repeater control? You must set the DataSource property and call the DataBind method.
28. What base class do all Web Forms inherit from? The Page class.
29. Name two properties common in every validation control? ControlToValidate property and Text property.
30. What tags do you need to add within the asp:datagrid tags to bind columns manually? Set AutoGenerateColumns Property to false on the datagrid tag
31. What tag do you use to add a hyperlink column to the DataGrid? <asp:HyperLinkColumn>
32. What is the transport protocol you use to call a Web service? SOAP is the preferred protocol.
33. True or False: A Web service can only be written in .NET? False
34. What does WSDL stand for? (Web Services Description Language)
35. Where on the Internet would you look for Web services? (http://www.uddi.org)
36. Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box? DataTextField property
37. Which control would you use if you needed to make sure the values in two different controls matched? CompareValidator Control
38. True or False: To test a Web service you must create a windows application or Web application to consume this service? False, the webservice comes with a test page and it provides HTTP-GET method to test.
39. How many classes can a single .NET DLL contain? It can contain many classes.
Labels: DotNet interview Questions
C# interview Questions
- What's the implicit name of the parameter that gets passed into the class' set method? Value, and its datatype depends on whatever variable we're changing.
- How do you inherit from a class in C#? Place a colon and then the name of the base class. Notice that it's double colon in C++.
- Does C# support multiple inheritance? No, use interfaces instead.
- When you inherit a protected class-level variable, who is it available to? Classes in the same namespace.
- Are private class-level variables inherited? Yes, but they are not accessible, so looking at it you can honestly say that they are not inherited. But they are.
- Describe the accessibility modifier protected internal. It's available to derived classes and classes within the same Assembly (and naturally from the base class it's declared in).
- C# provides a default constructor for me. I write a constructor that takes a string as a parameter, but want to keep the no parameter one. How many constructors should I write? Two. Once you write at least one constructor, C# cancels the freebie constructor, and now you have to write one yourself, even if there's no implementation in it.
- What's the top .NET class that everything is derived from? System.Object.
- How's method overriding different from overloading? When overriding, you change the method behavior for a derived class. Overloading simply involves having a method with the same name within the class.
- What does the keyword virtual mean in the method definition? The method can be over-ridden.
- Can you declare the override method static while the original method is non-static? No, you can't, the signature of the virtual method must remain the same, only the keyword virtual is changed to keyword override.
- Can you override private virtual methods? No, moreover, you cannot access private methods in inherited classes, have to be protected in the base class to allow any sort of access.
- Can you prevent your class from being inherited and becoming a base class for some other classes? Yes, that's what keyword sealed in the class definition is for. The developer trying to derive from your class will get a message: cannot inherit from Sealed class WhateverBaseClassName. It's the same concept as final class in Java.
- Can you allow class to be inherited, but prevent the method from being over-ridden? Yes, just leave the class public and make the method sealed.
- What's an abstract class? A class that cannot be instantiated. A concept in C++ known as pure virtual method. A class that must be inherited and have the methods over-ridden. Essentially, it's a blueprint for a class without any implementation.
- When do you absolutely have to declare a class as abstract (as opposed to free-willed educated choice or decision based on UML diagram)? When at least one of the methods in the class is abstract. When the class itself is inherited from an abstract class, but not all base abstract methods have been over-ridden.
- What's an interface class? It's an abstract class with public abstract methods all of which must be implemented in the inherited classes.
- Why can't you specify the accessibility modifier for methods inside the interface? They all must be public. Therefore, to prevent you from getting the false impression that you have any freedom of choice, you are not allowed to specify any accessibility, it's public by default.
- Can you inherit multiple interfaces? Yes, why not.
- And if they have conflicting method names? It's up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you're okay.
- What's the difference between an interface and abstract class? In the interface all methods must be abstract; in the abstract class some methods can be concrete. In the interface no accessibility modifiers are allowed, which is ok in abstract classes.
- How can you overload a method? Different parameter data types, different number of parameters, different order of parameters.
- If a base class has a bunch of overloaded constructors, and an inherited class has another bunch of overloaded constructors, can you enforce a call from an inherited constructor to an arbitrary base constructor? Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.
- What's the difference between System.String and System.StringBuilder classes? System.String is immutable; System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.
- What's the advantage of using System.Text.StringBuilder over System.String? StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time it's being operated on, a new instance is created.
- Can you store multiple data types in System.Array? No.
- What's the difference between the System.Array.CopyTo() and System.Array.Clone()? The first one performs a deep copy of the array, the second one is shallow.
- How can you sort the elements of the array in descending order? By calling Sort() and then Reverse() methods.
- What's the .NET datatype that allows the retrieval of data by a unique key? HashTable.
- What's class SortedList underneath? A sorted HashTable.
- Will finally block get executed if the exception had not occurred? Yes.
- What's the C# equivalent of C++ catch (…), which was a catch-all statement for any possible exception? A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}.
- Can multiple catch blocks be executed? No, once the proper catch code fires off, the control is transferred to the finally block (if there are any), and then whatever follows the finally block.
- Why is it a bad idea to throw your own exceptions? Well, if at that point you know that an error has occurred, then why not write the proper code to handle that error instead of passing a new Exception object to the catch block? Throwing your own exceptions signifies some design flaws in the project.
- What's a delegate? A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers.
- What's a multicast delegate? It's a delegate that points to and eventually fires off several methods.
- How's the DLL Hell problem solved in .NET? Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.
- What are the ways to deploy an assembly? An MSI installer, a CAB archive, and XCOPY command.
- What's a satellite assembly? When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.
- What namespaces are necessary to create a localized application? System.Globalization, System.Resources.
- What's the difference between // comments, /* */ comments and /// comments? Single-line, multi-line and XML documentation comments.
- How do you generate documentation from the C# file commented properly with a command-line compiler? Compile it with a /doc switch.
- What's the difference between <c> and <code> XML documentation tag? Single line code example and multiple-line code example.
- Is XML case-sensitive? Yes, so <Student> and <student> are different elements.
- What debugging tools come with the .NET SDK? CorDBG – command-line debugger, and DbgCLR – graphic debugger. Visual Studio .NET uses the DbgCLR. To use CorDbg, you must compile the original C# file using the /debug switch.
- What does the This window show in the debugger? It points to the object that's pointed to by this reference. Object's instance data is shown.
- What does assert() do? In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true.
- What's the difference between the Debug class and Trace class? Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds.
- Why are there five tracing levels in System.Diagnostics.TraceSwitcher? The tracing dumps can be quite verbose and for some applications that are constantly running you run the risk of overloading the machine and the hard drive there. Five levels range from None to Verbose, allowing to fine-tune the tracing activities.
- Where is the output of TextWriterTraceListener redirected? To the Console or a text file depending on the parameter passed to the constructor.
- How do you debug an ASP.NET Web application? Attach the aspnet_wp.exe process to the DbgClr debugger.
- What are three test cases you should go through in unit testing? Positive test cases (correct data, correct output), negative test cases (broken or missing data, proper handling), exception test cases (exceptions are thrown and caught properly).
- Can you change the value of a variable while debugging a C# application? Yes, if you are debugging via Visual Studio.NET, just go to Immediate window.
- Explain the three services model (three-tier application). Presentation (UI), business (logic and underlying code) and data (from storage or other sources).
- What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET? SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix, but it's a .NET layer on top of OLE layer, so not the fastest thing in the world. ODBC.NET is a deprecated layer provided for backward compatibility to ODBC engines.
- What's the role of the DataReader class in ADO.NET connections? It returns a read-only dataset from the data source when the command is executed.
- What is the wildcard character in SQL? Let's say you want to query database with LIKE for all employees whose name starts with La. The wildcard character is %, the proper query with LIKE would involve 'La%'.
- Explain ACID rule of thumb for transactions. Transaction must be Atomic (it is one unit of work and does not dependent on previous and following transactions), Consistent (data is either committed or roll back, no "in-between" case where something has been updated and something hasn't), Isolated (no transaction sees the intermediate results of the current transaction), Durable (the values persist if the data had been committed even if the system crashes right after).
- What connections does Microsoft SQL Server support? Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and passwords).
- Which one is trusted and which one is untrusted? Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction.
- Why would you use untrusted verificaion? Web Services might use it, as well as non-Windows applications.
- What does the parameter Initial Catalog define inside Connection String? The database name to connect to.
- What's the data provider name to connect to Access database? Microsoft.Access.
- What does Dispose method do with the connection object? Deletes it from the memory.
- What is a pre-requisite for connection pooling? Multiple processes must agree that they will share the same connection, where every parameter is the same, including the security settings.
Labels: DotNet interview Questions
Useful C# for interview point II
main must be a static method
In a static class we cant able to declare non static methods
In a non static class we can able to declare static methods
From a static method we cant able to call non static method. if need use an object for that class
From a non static method we can able to call static method
Two Non static classes:
From a non static method we cant call a non static method. need to create object for the class
From a non static method we cant call a static method. only able by using class name and dot(.)
From a static method we cant call a static method. only able by using class name and dot(.)
From a static method we cant call a non static method. need to create object for the class
Two static classes:
Cant able to create object for classs
From a static method we can call a static method. only able by using class name and dot(.)
Cant able to override non virtual or static methods
Cant able to create instance for interface or abstact class
you can use a cast to create an instance for an interface in C#
Cant able to inherit abstract method but able abstract class
Cant able to derive a sealed class
interface has only method declaration bcoz all method in interface are public and abstaract, Abstract method does not have any body
Abstract class have both abstract and nonabstract methodes.so those abstract methods only have declaration and non ablstract method have body also.
All abstract methods must implemented while using the abstract class or interface
Non abstract class doesnot contain abstract method
Boxing:
Value type to object type-implicit-compiler will do
unboxing
object type to value type-explicit-using type cast
We can override the base class method from deri class, only if the the base class method is virtual or abstract
Unlike base classes, interfaces don't implement any of their members by providing the actual code for properties, methods, and so on. Interfaces are just specifications for those members, and if your class implements an interface, it must provide code for all the members of that interface.
Delegates let you pass methods as parameters. They provide you with another form of polymorphism, because you can assign methods to delegates at runtime, leaving the rest of your code unchanged but calling the methods you specify at runtime.
No special impact for the delegate on static methods
BufferedStream object, which will use its own internal buffer to maximize performance
we've simply read data from a file and waited for the read operation to finish before doing anything. As we start working with network I/O, where things can be a lot slower, it won't be as easy to wait for reading and writing operations to complete. For that reason, the .NET Framework supports asynchronous I/O through the BeginRead and BeginWrite methods of the Stream class. You can call BeginRead to read a bufferfull of data, or BeginWrite to write a bufferfull of data, and then go on to do other work
C# enables you to save an entire object, including all its data (called an object-graph) through a process called serialization. Serialization lets you write entire objects out to disk and read them back in later. Objects that pass between assembly boundaries (through a process called marshalling) are also serialized.
The common language runtime does not support static variables in methods.
You don't have to serialize all the members of an object; for example, if you have a huge array filled with sequential numbers that's easy to re-create, there's no benefit to taking up a great deal of disk space by storing that array to memory. To mark members that you don't want serialized, you use the [NonSerialized] attribute.
if you didn't want to serialize the data array in ch05_13.cs, you could mark it with [NonSerialized]; note that when you use this attribute, you should implement the IDeserializationCallback interface,
Isolated storage saves data for your application that you might have stored in the Registry before.To store data in isolated storage, you use the IsolatedStorageFileStream class;(used to store configuration data)
You can also create arrays of arrays, called jagged arrays because they need not be rectangular.Here's the syntax you use to create an array of arrays.
Answer: Web services are programmable business logic components that provide access to functionality through the Internet. Standard protocols like HTTP can be used to access them. Web services are based on the Simple Object Access Protocol (SOAP), which is an application of XML. Web services are given the .asmx extension..
out and ref are reference type diff is ref must initialize.but out does not must be initialized
Eval is used for unidirectional (readonly) data binding, while Bind is for bi-directional (editable) databinding.
The Eval method is a static (read-only) method that takes the value of a data field and returns it as a string. The Bind method supports read/write functionality with the ability to retrieve the values of data-bound controls and submit any changes made back to the database.
DataSet is just a collection of DataTable objects
DataSet is an in-memory representation of data, containing one or more DataTables. A DataTable is an in-memory representation of data, typically retrieved from a database or XML source.
A DataView is a view onto an in-memory representation of data held in a DataTable.
Labels: DotNet interview Questions
Useful C# for interview point
in such methods. It's important to know that static methods cannot directly access non-static
members (which means, for example, that you cannot call a non-static method from a static
method). Instead, they must instantiate an object and use the members of that object to
access non-static members .
Static constructors are called before any objects(constructor) are created from your class
what's the difference between new and override? You use new when you're replacing a
base class method with the same signature, and you use override when you're customizing it
in the current class.
Labels: DotNet interview Questions
Power of the DataView
The Power of the DataView
Introduction
Its hard to imagine what the creators of ADO.NET were thinking as they were designing it. It has been challenge enough just understanding and mastering all of the many objects and their capabilities. Just think, to physically access a column of data you have to now maneuver through at least five objects instead of two in ADO.
As part of my effort to learn ADO.NET, I decided to first determine how to reproduce the basic functionality that I had in ADO, especially with the Recordset. That is where I discovered the new and many uses of the DataView class (although I prefer the term object to class).
Think about the following code snippet:
objRS.Sort = "CompanyName" |
If the Recordset was the order detail for a customer, the sort order was specified on OrderNumber followed by ProductName. Then we used the marvelous Filter method of the Recordset to create a view of only those records we wished to work with. After we were through, we removed both the sort and the filter to perform any other tasks that were necessary.
When I first started working with ADO.NET, I just couldnt seem to figure out how to easily reproduce this functionality. Sure, you can bind a DataSet to a grid with just two lines of code. But where were examples of how to perform tasks where I needed more than just databinding to a DataTable? Thats when I stumbled across the DataView class.
I like to use the following analogy. DataSets are very much like simple, stand-alone databases. They contain tables called DataTables with rows and columns. These tables can have relationships. They also contain views called DataViews. The DataView class is very similar to a database view that you would create in Oracle or SQL Server. You can use a DataView just about anywhere you can use a DataTable. Yet they contain some additional properties and methods that a DataTable does not.
Sorting, Finding and Filtering
Three of the most useful things that you can do with a DataView are sorting, finding specific rows and filtering unwanted records. If I could do these things with a view, then I could reproduce the code snippet above using ADO.NET:
Dim dv As DataView |
At this point you can either Bind the view to one of the ASP.NET server side controls or you can process each row individually:
Dim i As Integer |
In ADO.NET, there is no MoveFirst, MoveNext, MovePrior or MoveLast. Nor is there EOF or BOF. The data is all referenced as an array. To see if data is present, just check the Count property of the DataView (no more EOF runtime errors!). Remember that arrays begin at 0 and not 1.
If you want to filter rows with null values, you must first convert the null values to something such as a string:
dv.RowFilter = "Isnull(Col1,'Null') = 'Null'" |
Only the Tip of the Iceberg
DataViews are also useful for other things than just the functions that we just discussed. Think about this: Every table has at least one DataView, which is a view of itself. This is called the DefaultView. That means that if you reference a table by its DefaultView, it can do anything a DataView can do as well:
DataSet1.Tables(0).DefaultView.Sort = "CompanyName" |
Another great feature of DataViews is that you can create them with the RowFilter and Sort already specified:
Dim dv As New DataView(ds.Tables("Country"), _ |
DataView Differences
Of course, the DataView is not a DataTable. The most obvious difference is that DataViews are comprised of DataRowViews where as a table contains DataRows. DataRowViews do not contain a Columns collection, but an Item property to reference the underlying column. And editing data in a DataRowView is also different. But there is one trick that you can play on the DataRowView. Just like every table has a DefaultDataView property, the DataRowView has a Row property that is an actual reference to the underlying DataRow:
Dim drv As DataRowView |
Conclusion
As you can see, this is just one of the many areas where ADO.NET differs dramatically from ADO. Now that Ive discovered the DataView, Ive been able to reproduce the functionality that was in my old ASP application in my new ASP.NET applications. And with a little more practice, I hope to even overcome obstacles that were present with the Recordset.
Labels: C#
Generics
Generics allow you to realize type safety at compile time. They allow you to create a data structure without committing to a specific data type. When the data structure is used, however, the compiler makes sure that the types used with it are consistent for type safety. Generics provide type safety, but without any loss of performance or code bloat. While they are similar to templates in C++ in this regard, they are very different in their implementation.What Are Generics?
Using Generics Collections
The System.Collections.Generics namespace contains the generics collections
Y Generics
ex: Generics is not a mere language-level feature. The .NET CLR recognizes generics. In Writing a generic class I have created a generic class named In the Have you worked the above question? Did you get the following answer? In addition to having generic classes, you may also have generic methods. Generic methods Example 4. A generic method The If you create generics data structures or classes, like The implementation of operators such as A generic class allows you to write your class without committing to any type, yet allows Example 5. The need for constraints: code that will not compile The code in Example 5 will produce a compilation error: Assume I need the type to support the Example 6. Specifying a constraint In Example 6, I have specified the constraint that the type used for You may specify a combination of constraints, as in: A generic class that uses parameterized types, like You may derive from a closed-constructed generic; that is, you may inherit a class You may derive from an open-constructed generic, provided the type is parameterized. is valid, but is not valid, where is valid, but is not.List<int> aList = new List<int>();
aList.Add(3);
aList.Add(4);
aList.Add(5.0);
int total = 0;
foreach(int val in aList)
{
total = total + val;
}
This will cause an compiler error bcoz not able to cast the double5.0 to integer
But the same was handled as error at runtime while using arraylist.CLR Support for Generics
that regard, the use of generics is a first-class feature in .NET. For each type of parameter used for
a generic, a class is not rolled out in the Microsoft Intermediate Language (MSIL). In
other words, your assembly contains only one definition of your parameterized data
structure or class, irrespective of how many different types are used for that parameterized
type. For instance, if you define a generic type MyList, only one definition of that
type is present in MSIL. When the program executes, different classes are dynamically created,
one for each type for the parameterized type. If you use MyList andMyList, then two classes are created on the fly when your program executes.
//MyList.cs
#region Using directives
using System;
using System.Collections.Generic;
using System.Text;
#endregion
namespace CLRSupportExample
{
public class MyList
{
private static int objCount = 0;
public MyList()
{
objCount++;
}
public int Count
{
get
{
return objCount;
}
}
}
}
//Program.cs
#region Using directives
using System;
using System.Collections.Generic;
using System.Text;
#endregion
namespace CLRSupportExample
{
class SampleClass {}
class Program
{
static void Main(string[] args)
{
MyList
MyList
MyList
= new MyList
MyList
= new MyList
Console.WriteLine(myIntList.Count);
Console.WriteLine(myIntList2.Count);
Console.WriteLine(myDoubleList.Count);
Console.WriteLine(mySampleList.Count);
Console.WriteLine(
new MyList
Console.ReadLine();
}
}
}MyList. To parameterize it, I simply inserted an angle
bracket. The T within <> represents the actual type that will be specified when the
class is used. Within the MyList class, I have a static field, objCount. I am incrementing this
within the constructor so I can find out how many objects of that type are created by the
user of my class. The Count property returns the number of instances of the same type as
the instance on which it is called.Main() method, I am creating two instances of MyList, one instance ofMyList, and two instances of MyList, whereSampleClass is a
class I have defined. The question is: what will be the value of Count? That is, what is the
output from the above program? Go ahead and think on this and try to answer this
question before you read further.
2
2
1
1
2Generics Methods
may be part of any class. Let's look at Example 4:
public class Program
{
public static void Copy
{
foreach (T obj in source)
{
destination.Add(obj);
}
}
static void Main(string[] args)
{
List
lst1.Add(2);
lst1.Add(4);
List
Copy(lst1, lst2);
Console.WriteLine(lst2.Count);
}
}Copy() method is a generic method that works with the parameterized type T.
When Copy() is invoked in Main(), the compiler figures out the specific
type to use, based on the arguments presented to the Copy() method.Unbounded Type Parameters
MyList in Example 3, there are no
restrictions on what type the parametric type you may use for the parameteric type. This
leads to some limitations, however. For example, you are not allowed to use==, !=, or < on instances of the parametric type:
if (obj1 == obj2) …== and != are different for value types and
reference types. The behavior of the code may not be easier to understand if these were
allowed arbitrarily. Another restriction is the use of default constructor. For instance, if
you write new T(), you will get a compilation error, because not all classes have a
no-parameter constructor. What if you do want to create an object using new T(), or you
want to use operators such as == and !=? You can, but first you have to constraint the type
that can be used for the parameterized type. Let's look at how to do that.Constraints and Their Benefits
the user of your class, later on, to indicate the specific type to be used. While this
gives greater flexibility by placing some constraints on the types that may be used for
the parameterized type, you gain some control in writing your class. Let's look at an example:
public static T Max
{
if (op1.CompareTo(op2) <>
Error 1 'T' does not contain a definition for 'CompareTo'CompareTo() method. I can specify
this by using the constraint that the type specified for the parameterized type must implement theIComparable interface. Example 6 has the code:
public static T Max
{
if (op1.CompareTo(op2) <>
parameterized type must inherit from (implement) IComparable.
The following constraints may be used:
where T : struct type must be a value type (a struct)
where T : class type must be reference type (a class)
where T : new() type must have a no-parameter constructor
where T : class_name type may be either class_name or one of its
sub-classes (or is below class_name
in the inheritance hierarchy)
where T : interface_name type must implement the specified interfacewhere T : IComparable, new().
This says that the type for the parameterized type must implement theIComparable interface and must have a no-parameter constructor.Inheritance and Generics
MyClass1, is called
an open-constructed generic. A generic class that uses no parameterized types,
like MyClass1, is called a closed-constructed generic.
named MyClass2 from another class named MyClass1, as in:
public class MyClass2
For example:
public class MyClass2
public class MyClass2Y is a parameterized type. Non-generic classes may derive from closed-constructed
generic classes, but not from open-constructed generic classes. That is,
public class MyClass : MyClass1
public class MyClass : MyClass1
Generics' Limitations
We have seen the power of generics so far in this article. Are there any limitations? There is one significant limitation, which I hope Microsoft addresses. In expressing constraints, we can specify that the parameter type must inherit from a class. How about specifying that the parameter must be a base class of some class? Why do we need that?
In Example 4, I showed you a Copy() method that copied contents of a source List to a destination list. I can use it as follows:
List appleList1 = new List(); List appleList2 = new List(); … Copy(appleList1, appleList2); However, what if I want to copy apples from one list into a list of Fruits (where Apple inherits from Fruit). Most certainly, a list of Fruits can hold Apples. So I want to write:
List appleList1 = new List(); List fruitsList2 = new List(); … Copy(appleList1, fruitsList2); This will not compile. You will get an error:
Error 1 The type arguments for method 'TestApp.Program.Copy(System.Collections.Generic.List, System.Collections.Generic.List)' cannot be inferred from the usage. The compiler, based on the call arguments, is not able to decide what T should be. What I really want to say is that the Copy should accept a List of some type as the first parameter, and a ListList of its base type as the second parameter. of the same type or a
Even though there is no way to say that a type must be a base type of another, you can get around this limitation by still using the constraints. Here is how:
public static void Copy(List source, List destination) where T : E Here I have specified that the type T must be the same type as, or a sub-type of, E. We got lucky with this. Why? Both T and E are being defined here. We were able to specify the constraint (though the C# specification discourages using E to define the constraint of T when E is being defined as well).
Consider the following example, however:
public class MyList { public void CopyTo(MyList destination) { //… } } I should be able to call CopyTo:
MyList appleList = new MyList(); MyList appleList2 = new MyList(); //… appleList.CopyTo(appleList2); I must also be able to do this:
MyList appleList = new MyList(); MyList fruitList2 = new MyList(); //… appleList.CopyTo(fruitList2); This, of course, will not work. How can we fix this? We need to say that the argument to CopyTo()MyList of some type or MyList of the base type of that type. However, the constraints do not allow us to specify the base type. How about the following? can be either
public void CopyTo(MyList destination) where T : E Sorry, this does not work. It gives a compilation error that:
Error 1 'TestApp.MyList.CopyTo()' does not define type parameter 'T' Of course, you may write the code to accept MyList of any arbitrary type and then within your code, you may verify that the type is one of acceptable type. However, this pushes the checking to runtime, losing the benefit of compile-time type safety.
Conclusion
Generics in .NET 2.0 are very powerful. They allow you to write code without committing to a particular type, yet your code can enjoy type safety. Generics are implemented in such a way as to provide good performance and avoid code bloat. While there is the drawback of constraints' inability to specify that a type must be a base type of another type, the constraints mechanism gives you the flexibility to write code with a greater degree of freedom than sticking with the least-common-denominator capability of all types.
Labels: C#
VB6 - Disable mouse events
How to Disable mouse events in vb6
Code:
Option Explicit
Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Not ((X > Text1.Left And X < Text1.Left + Text1.Width) And (Y > Text1.Top And Y < Text1.Top + Text1.Height)) Then _
ReleaseCapture
End Sub
Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
SetCapture Me.hwnd
End Sub
Asp.net Questions(part2)
- What is an interface and what is an abstract class?
In an interface, all methods must be abstract (must not be defined). In an abstract class, some methods can be defined. In an interface, no accessibility modifiers are allowed, whereas it is allowed in abstract classes.
- Session state vs. View state:
In some cases, using view state is not feasible. The alternative for view state is session state. Session state is employed under the following situations:
- Large amounts of data - View state tends to increase the size of both the HTML page sent to the browser and the size of form posted back. Hence session state is used.
- Secure data - Though the view state data is encoded and may be encrypted, it is better and secure if no sensitive data is sent to the client. Thus, session state is a more secure option.
- Problems in serializing of objects into view state - View state is efficient for a small set of data. Other types like
DataSetare slower and can generate a very large view state.
- Can two different programming languages be mixed in a single ASPX file?
ASP.NET's built-in parsers are used to remove code from ASPX files and create temporary files. Each parser understands only one language. Therefore mixing of languages in a single ASPX file is not possible.
- Is it possible to see the code that ASP.NET generates from an ASPX file?
By enabling debugging using a
<%@ Page Debug="true" %>directive in the ASPX file or a<compilation debug="true">statement in Web.config, the generated code can be viewed. The code is stored in a CS or VB file (usually in the \%SystemRoot%\Microsoft.NET\Framework\v1.0.nnnn\Temporary ASP.NET Files). - Can a custom .NET data type be used in a Web form?
This can be achieved by placing the DLL containing the custom data type in the application root's bin directory and ASP.NET will automatically load the DLL when the type is referenced.
- List the event handlers that can be included in Global.asax?
- Application start and end event handlers
- Session start and end event handlers
- Per-request event handlers
- Non-deterministic event handlers
- Can the view state be protected from tampering?
This can be achieved by including an
@ Pagedirective with anEnableViewStateMac="true"attribute in each ASPX file that has to be protected. Another way is to include the<pages enableViewStateMac="true" />statement in the Web.config file. - Can the view state be encrypted?
The view state can be encrypted by setting
EnableViewStateMactotrueand either modifying the<machineKey>element in Machine.config to<machineKey validation="3DES" />or by adding the above statement to Web.config. - When during the page processing cycle is ViewState available?
The view state is available after the
Init()and before theRender()methods are called during Page load. - Do Web controls support Cascading Style Sheets?
All Web controls inherit a property named
CssClassfrom the base classSystem.Web.UI.WebControls.WebControlwhich can be used to control the properties of the web control. - What namespaces are imported by default in ASPX files?
The following namespaces are imported by default. Other namespaces must be imported manually using
@ Importdirectives.-
System -
System.Collections -
System.Collections.Specialized -
System.Configuration -
System.Text -
System.Text.RegularExpressions -
System.Web -
System.Web.Caching -
System.Web.Security -
System.Web.SessionState -
System.Web.UI -
System.Web.UI.HtmlControls -
System.Web.UI.WebControls
-
- What classes are needed to send e-mail from an ASP.NET application?
The classes
MailMessageandSmtpMailhave to be used to send email from an ASP.NET application.MailMessageandSmtpMailare classes defined in the .NET Framework Class Library'sSystem.Web.Mailnamespace. - Why do some web service classes derive from System.Web.WebServices while others do not?
Those Web Service classes which employ objects like
Application,Session,Context,Server, andUserhave to derive fromSystem.Web.WebServices. If it does not use these objects, it is not necessary to be derived from it. - What are VSDISCO files?
VSDISCO files are DISCO files that enable dynamic discovery of Web Services. ASP.NET links the VSDISCO to a HTTP handler that scans the host directory and subdirectories for ASMX and DISCO files and returns a dynamically generated DISCO document. A client who requests a VSDISCO file gets back what appears to be a static DISCO document.
- How can files be uploaded to Web pages in ASP.NET?
This can be done by using the
HtmlInputFileclass to declare an instance of an<input type="file" runat="server"/>tag. Then, abyte[]can be declared to read in the data from the input file. This can then be sent to the server. - How do I create an ASPX page that periodically refreshes itself?
The following
METAtag can be used as a trigger to automatically refresh the page every n seconds:<meta http-equiv="Refresh" content="nn">
- How do I initialize a TextBox whose TextMode is "password", with a password?
The
TextBox'sTextproperty cannot be used to assign a value to a password field. Instead, itsValuefield can be used for that purpose.<asp:TextBox Value="imbatman" TextMode="Password"
ID="Password" RunAt="server" /> - Why does the control's PostedFile property always show null when using HtmlInputFile control to upload files to a Web server?
This occurs when an
enctype="multipart/form-data"attribute is missing in the<form>tag. - How can the focus be set to a specific control when a Web form loads?
This can be achieved by using client-side script:
document.forms[0].TextBox1.focus ()The above code will set the focus to a
TextBoxnamedTextBox1when the page loads. - How does System.Web.UI.Page's IsPostBack property work?
IsPostBackchecks to see whether the HTTP request is accompanied by postback data containing a__VIEWSTATEor__EVENTTARGETparameter. If there are none, then it is not a postback. - What is WSDL?
WSDL is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented information. The operations and messages are described abstractly, and then bound to a concrete network protocol and message format to define an endpoint. Related concrete endpoints are combined into abstract endpoints (services). (Source: www.w3.org)
- What is UDDI?
UDDI stands for Universal Description, Discovery, and Integration. It is like an "Yellow Pages" for Web Services. It is maintained by Microsoft, IBM, and Ariba, and is designed to provide detailed information regarding registered Web Services for all vendors. The UDDI can be queried for specific Web Services.
- Is it possible to generate the source code for an ASP.NET Web service from a WSDL?
The Wsdl.exe tool (.NET Framework SDK) can be used to generate source code for an ASP.NET web service with its WSDL link.
Example: wsdl /server http://api.google.com/GoogleSearch.wsdl.
- Why do uploads fail while using an ASP.NET file upload control to upload large files?
ASP.NET limits the size of file uploads for security purposes. The default size is 4 MB. This can be changed by modifying the
maxRequestLengthattribute of Machine.config's<httpRuntime>element. - Describe the difference between inline and code behind.
Inline code is written along side the HTML in a page. Code-behind is code written in a separate file and referenced by the .aspx page.
- Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process.
inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe.
- Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
Valid answers are:
- A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
- A DataSet is designed to work without any continuing connection to the original data source.
- Data in a DataSet is bulk-loaded, rather than being loaded on demand.
- There's no concept of cursor types in a DataSet.
- DataSets have no current record pointer You can use For Each loops to move through the data.
- You can store many edits in a DataSet, and write them to the original data source in a single operation.
- Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.
- What's a bubbled event?
When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.
- What data types do the RangeValidator control support?
Integer, String, and Date.
- Explain what a diffgram is, and a good use for one?
The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. A good use is reading database data to an XML file to be sent to a Web Service.
- What is the transport protocol you use to call a Web service?
SOAP (Simple Object Access Protocol) is the preferred protocol.
- What is ViewState?
ViewState allows the state of objects (serializable) to be stored in a hidden field on the page. ViewState is transported to the client and back to the server, and is not stored on the server or any other external source. ViewState is used the retain the state of server-side objects between postabacks.
- What does the "EnableViewState" property do? Why would I want it on or off?
It allows the page to save the users input on a form across postbacks. It saves the server-side values for a given control into ViewState, which is stored as a hidden value on the page before sending the page to the clients browser. When the page is posted back to the server the server control is recreated with the state stored in viewstate.
- What are the different types of Session state management options available with ASP.NET?
ASP.NET provides In-Process and Out-of-Process state management. In-Process stores the session in memory on the web server. This requires the a "sticky-server" (or no load-balancing) so that the user is always reconnected to the same web server. Out-of-Process Session state management stores data in an external data source. The external data source may be either a SQL Server or a State Server service. Out-of-Process state management requires that all objects stored in session are serializable.
- Differences Between XML and HTML?
Anyone with a fundamental grasp of XML should be able describe some of the main differences outlined in the table below
XML
HTML
User definable tags Defined set of tags designed for web display Content driven Format driven End tags required for well formed documents End tags not required Quotes required around attributes values Quotes not required Slash required in empty tags Slash not required - Give a few examples of types of applications that can benefit from using XML.
There are literally thousands of applications that can benefit from XML technologies. The point of this question is not to have the candidate rattle off a laundry list of projects that they have worked on, but, rather, to allow the candidate to explain the rationale for choosing XML by citing a few real world examples. For instance, one appropriate answer is that XML allows content management systems to store documents independently of their format, which thereby reduces data redundancy. Another answer relates to B2B exchanges or supply chain management systems. In these instances, XML provides a mechanism for multiple companies to exchange data according to an agreed upon set of rules. A third common response involves wireless applications that require WML to render data on hand held devices.
- What is DOM and how does it relate to XML?
The Document Object Model (DOM) is an interface specification maintained by the W3C DOM Workgroup that defines an application independent mechanism to access, parse, or update XML data. In simple terms it is a hierarchical model that allows developers to manipulate XML documents easily Any developer that has worked extensively with XML should be able to discuss the concept and use of DOM objects freely. Additionally, it is not unreasonable to expect advanced candidates to thoroughly understand its internal workings and be able to explain how DOM differs from an event-based interface like SAX.
- What is SOAP and how does it relate to XML?
The Simple Object Access Protocol (SOAP) uses XML to define a protocol for the exchange of information in distributed computing environments. SOAP consists of three components: an envelope, a set of encoding rules, and a convention for representing remote procedure calls. Unless experience with SOAP is a direct requirement for the open position, knowing the specifics of the protocol, or how it can be used in conjunction with HTTP, is not as important as identifying it as a natural application of XML.
- Can you walk us through the steps necessary to parse XML documents?
Superficially, this is a fairly basic question. However, the point is not to determine whether candidates understand the concept of a parser but rather have them walk through the process of parsing XML documents step-by-step. Determining whether a non-validating or validating parser is needed, choosing the appropriate parser, and handling errors are all important aspects to this process that should be included in the candidate's response.
- What are possible implementations of distributed applications in .NET?
.NET Remoting and ASP.NET Web Services. If we talk about the Framework Class Library, noteworthy classes are in System.Runtime.Remoting and System.Web.Services.
- What are the consideration in deciding to use .NET Remoting or ASP.NET Web Services?
Remoting is a more efficient communication exchange when you can control both ends of the application involved in the communication process. Web Services provide an open-protocol-based exchange of informaion. Web Services are best when you need to communicate with an external organization or another (non-.NET) technology.
- What's a proxy of the server object in .NET Remoting?
It's a fake copy of the server object that resides on the client side and behaves as if it was the server. It handles the communication between real server object and the client object. This process is also known as marshaling.
- What are remotable objects in .NET Remoting?
Remotable objects are the objects that can be marshaled across the application domains. You can marshal by value, where a deep copy of the object is created and then passed to the receiver. You can also marshal by reference, where just a reference to an existing object is passed.
- What are channels in .NET Remoting?
Channels represent the objects that transfer the other serialized objects from one application domain to another and from one computer to another, as well as one process to another on the same box. A channel must exist before an object can be transferred.
- What security measures exist for .NET Remoting in System.Runtime.Remoting?
None. Security should be taken care of at the application level. Cryptography and other security techniques can be applied at application or server level.
- What is a formatter?
A formatter is an object that is responsible for encoding and serializing data into messages on one end, and deserializing and decoding messages into data on the other end.
- Choosing between HTTP and TCP for protocols and Binary and SOAP for formatters, what are the trade-offs?
Binary over TCP is the most effiecient, SOAP over HTTP is the most interoperable.
- What's SingleCall activation mode used for?
If the server object is instantiated for responding to just one single request, the request should be made in SingleCall mode.
- What's Singleton activation mode?
A single object is instantiated regardless of the number of clients accessing it. Lifetime of this object is determined by lifetime lease.
- How do you define the lease of the object?
By implementing ILease interface when writing the class code.
- Can you configure a .NET Remoting object via XML file?
Yes, via machine.config and application level .config file (or web.config in ASP.NET). Application-level XML settings take precedence over machine.config.
- How can you automatically generate interface for the remotable object in .NET with Microsoft tools?
Use the Soapsuds tool.
Labels: DotNet interview Questions
