Difference between typed dataset and untyped dataset in .Net framework
Datasets can be typed or untyped.
A typed dataset is a dataset that is first derived from the base DataSet class and then uses information in an XML Schema file (an .xsd file) to generate a new class. Information from the schema (tables, columns, and so on) is generated and compiled into this new dataset class as a set of first-class objects and properties.
An untyped dataset, in contrast, has no corresponding built-in schema. As in a typed dataset,
an untyped dataset contains tables, columns, and so on — but those are exposed only as collections.
Typed DataSet
// C#
// This accesses the CustomerID column in the first row of
// the Customers table.
string s;
s = dsCustomersOrders1.Customers[0].CustomerID;
Untyped Datasets
// C#
string s = (string) dsCustomersOrders1.Tables["Customers"].Rows[0]["CustomerID"];
In addition to being easier to work with, the syntax for the typed dataset provides type checking at compile time, greatly reducing the possibility of errors in assigning values to dataset members.
Dotnet, DotnetCore, Azure, C#,VB.net, Sql Server, WCF, MVC ,Linq, Javascript and Jquery
16 April 2011
Generics in .Net Framework
Generics in .Net Framework
Used to Reduced run-time errors,The compiler cannot detect type errors when you cast
to and from the Object class.the runtime will throw an exception
Using generics allows the compiler to catch this type of bug before your program runs
Generics improves runtime Performance.
Eg:
// Add a double and an int using the Obj class
Obj ob = new Obj(10.125, 2005);
Console.WriteLine((double)ob.t + (int)ob.u);
// Add a double and an int using the Gen class
Gen gb = new Gen(10.125, 2005);
Console.WriteLine(gb.t + gb.u);
If you run that code in a console application, the Obj and Gen classes produce exactly
the same results. However, the code that uses the Gen class actually works faster
because it does not require boxing and unboxing to and from the Object class.
Used to Reduced run-time errors,The compiler cannot detect type errors when you cast
to and from the Object class.the runtime will throw an exception
Using generics allows the compiler to catch this type of bug before your program runs
Generics improves runtime Performance.
Eg:
// Add a double and an int using the Obj class
Obj ob = new Obj(10.125, 2005);
Console.WriteLine((double)ob.t + (int)ob.u);
// Add a double and an int using the Gen class
Gen
Console.WriteLine(gb.t + gb.u);
If you run that code in a console application, the Obj and Gen classes produce exactly
the same results. However, the code that uses the Gen class actually works faster
because it does not require boxing and unboxing to and from the Object class.
Commonly used interfaces in .Net
Commonly used interfaces
Class Description
IComparable
-----------
Implemented by types whose values can be ordered; for example, the numeric and string classes. IComparable is required for sorting.
IDisposable
-----------
Defines methods for manually disposing of an object. This interface is important for large objects that consume resources, or objects that lock access to resources such as databases.
IConvertible
------------
Enables a class to be converted to a base type such as Boolean,Byte, Double, or String.
ICloneable
----------
Supports copying an object.
IEquatable
----------
Allows you to compare to instances of a class for equality. For example, if you implement this interface, you could say “if (a == b)”.
IFormattable
------------
Enables you to convert the value of an object into a specially formatted string. This provides greater flexibility than the base ToString method.
Class Description
IComparable
-----------
Implemented by types whose values can be ordered; for example, the numeric and string classes. IComparable is required for sorting.
IDisposable
-----------
Defines methods for manually disposing of an object. This interface is important for large objects that consume resources, or objects that lock access to resources such as databases.
IConvertible
------------
Enables a class to be converted to a base type such as Boolean,Byte, Double, or String.
ICloneable
----------
Supports copying an object.
IEquatable
----------
Allows you to compare to instances of a class for equality. For example, if you implement this interface, you could say “if (a == b)”.
IFormattable
------------
Enables you to convert the value of an object into a specially formatted string. This provides greater flexibility than the base ToString method.
15 April 2011
Disable remember password option in Firefox/Internet Explorer In Code
Disable remember password option in Firefox/Internet Explorer In Code
For Disable remember password option in Firefox/Internet Explorer In Form
<form id="loginForm" autocomplete="off">
</form>
For Disable remember password option in Firefox/Internet Explorer In Particular Controls
<asp:TextBox ID="TextBox1" autocomplete="off" runat="server" TextMode="Password">
For Disable remember password option in Firefox/Internet Explorer In Form
<form id="loginForm" autocomplete="off">
</form>
For Disable remember password option in Firefox/Internet Explorer In Particular Controls
<asp:TextBox ID="TextBox1" autocomplete="off" runat="server" TextMode="Password">
11 April 2011
How to Overcome multiline textbox [draggable] for mozilla firefox and Chrome Browser in asp.net
How to Overcome multiline textbox [draggable] for mozilla firefox and Chrome Browser in asp.net
You can add it in a css file
textarea{resize:none;}
You can add it in a css file
textarea{resize:none;}
26 January 2011
WCF VS Web Services
WCF VS Web Services
Rich Set of Protocol
WCF supports more protocols for transporting messages than ASP.NET Web services. ASP.NET Web services only support sending messages by using the Hypertext Transfer Protocol (HTTP). WCF supports sending messages by using HTTP, as well as the Transmission Control Protocol (TCP), named pipes, and Microsoft Message Queuing (MSMQ). More important, WCF can be extended to support additional transport protocols. Therefore, software developed using WCF can be adapted to work together with a wider variety of other software, thereby increasing the potential return on the investment.
WCF provides much richer facilities for deploying and managing applications than ASP.NET Web services provides. In addition to a configuration system, which ASP.NET also has, WCF offers a configuration editor, activity tracing from senders to receivers and back through any number of intermediaries, a trace viewer, message logging, a vast number of performance counters, and support for Windows Management Instrumentation.
Rich Set of Protocol
WCF supports more protocols for transporting messages than ASP.NET Web services. ASP.NET Web services only support sending messages by using the Hypertext Transfer Protocol (HTTP). WCF supports sending messages by using HTTP, as well as the Transmission Control Protocol (TCP), named pipes, and Microsoft Message Queuing (MSMQ). More important, WCF can be extended to support additional transport protocols. Therefore, software developed using WCF can be adapted to work together with a wider variety of other software, thereby increasing the potential return on the investment.
WCF provides much richer facilities for deploying and managing applications than ASP.NET Web services provides. In addition to a configuration system, which ASP.NET also has, WCF offers a configuration editor, activity tracing from senders to receivers and back through any number of intermediaries, a trace viewer, message logging, a vast number of performance counters, and support for Windows Management Instrumentation.
WPF vs. Silverlight in .net
WPF vs. Silverlight in .net
Both WPF and Silverlight use XAML (Extensible Application Markup Language) under the covers.
Let's look at some of the different characteristics of each technology:
WPF:
* Ships as part of the .NET Framework (version 3.0 and onward)
* Runs as Windows application or as web "browser application" (called XBAP, for "XAML Browser Application"). Note that XBAPs run only in Internet Explorer with .NET 3.0 and in both Internet Explorer and Firefox with .NET 3.5.
* Runs on Windows machines only (Windows XP, Windows Server 2003, Windows Vista, and Windows Server 2008)
* Richest functionality, including 3D graphics
Silverlight:
* Ships independently
* Runs in web browsers only (Internet Explorer, Firefox, Safari)
* Runs on Windows or Mac operating systems (also on Linux via Moonlight,which is an open source implementation of Silverlight based on Mono)
* Functionality is a subset of WPF's feature set
WPF is a more mature technology and was designed with a richer feature set. It also has the advantage of being able to run in a browser or as an installed Windows-Form-type app.
Silverlight has a broader reach.You can access Silverlight from many operating systems and web browsers.
The most important reason to choose one over the other should be based on the intended audience for the application. For example, if a corporation is designing an application for internal use only and every employee has Windows XP as the company standard OS, then go with WPF to leverage the richer feature set. If a corporation is designing an external-facing website, then Silverlight is the better choice because potential customers can access the website from a variety of different operating systems and browsers.
Both WPF and Silverlight use XAML (Extensible Application Markup Language) under the covers.
Let's look at some of the different characteristics of each technology:
WPF:
* Ships as part of the .NET Framework (version 3.0 and onward)
* Runs as Windows application or as web "browser application" (called XBAP, for "XAML Browser Application"). Note that XBAPs run only in Internet Explorer with .NET 3.0 and in both Internet Explorer and Firefox with .NET 3.5.
* Runs on Windows machines only (Windows XP, Windows Server 2003, Windows Vista, and Windows Server 2008)
* Richest functionality, including 3D graphics
Silverlight:
* Ships independently
* Runs in web browsers only (Internet Explorer, Firefox, Safari)
* Runs on Windows or Mac operating systems (also on Linux via Moonlight,which is an open source implementation of Silverlight based on Mono)
* Functionality is a subset of WPF's feature set
WPF is a more mature technology and was designed with a richer feature set. It also has the advantage of being able to run in a browser or as an installed Windows-Form-type app.
Silverlight has a broader reach.You can access Silverlight from many operating systems and web browsers.
The most important reason to choose one over the other should be based on the intended audience for the application. For example, if a corporation is designing an application for internal use only and every employee has Windows XP as the company standard OS, then go with WPF to leverage the richer feature set. If a corporation is designing an external-facing website, then Silverlight is the better choice because potential customers can access the website from a variety of different operating systems and browsers.
Subscribe to:
Posts (Atom)
Implementing OAuth validation in a Web API
I mplementing OAuth validation in a Web API Implementing OAuth validation in a Web API using C# typically involves several key steps to sec...
-
ViewBag, ViewData, TempData and View State in MVC ASP.NET MVC offers us three options ViewData, ViewBag and TempData for passing data from...
-
// Export Datatable to Excel in C# Windows application using System; using System.Data; using System.IO; using System.Windows.Forms; ...
-
GROUP BY in SQL Server In SQL Server, the `GROUP BY` statement is used to arrange identical data into groups. This statement is often used...