Documentos de Académico
Documentos de Profesional
Documentos de Cultura
html
http://www.c-
sharpcorner.com/Articles/ArticleListing.aspx?SectionID=1&SubSectionID=191
Interface is a class which contain all unimplemented methods( can call them also
abstract methods)
We will implement these methods in derived class of interface.
ie an interface is actually not inherited but implemented.
We cann't create an instance of interface object instead we can create an instance
for derived class objects...(I think this u know)
If the requirement is like that something in your design changes frequently then
go for interfaces instead of classes
For example if you want to your project should support different databases . so
that client can change his database in future we use interfaces contains property
procedures in class file with out altering objects
Here is another example, the Strategy pattern lets you swap new algorithms and
processes into your program without altering the objects that use them. A media
player might know how to play CDs, MP3s, and wav files. Of course, you don't want
to hardcode those playback algorithms into the player; that will make it difficult
to add a new format like AVI. Furthermore, your code will be littered with useless
case statements. And to add insult to injury, you will need to update those case
statements each time you add a new algorithm. All in all, this is not a very
object-oriented way to program.
With the Strategy pattern, you can simply encapsulate the algorithm behind an
object. If you do that, you can provide new media plug-ins at any time. Let's call
the plug-in class MediaStrategy. That object would have one method:
playStream(Stream s). So to add a new algorithm, we simply extend our algorithm
class. Now, when the program encounters the new media type, it simply delegates
the playing of the stream to our media strategy. Of course, you'll need some
plumbing to properly instantiate the algorithm strategies you will need.
This is an excellent place to use an interface. Thus, you should define the
strategy as an interface. You should generally favor interfaces over inheritance
when you want an object to have a certain type; in this case, MediaStrategy.
Relying on inheritance for type identity is dangerous; it locks you into a
particular inheritance hierarchy. C# doesn't allow multiple inheritance, so you
can't extend something that gives you a useful implementation or more type
identity.
So we use interfaces
LINQ Advantages
1. LINQ syntax beats SQL syntax. SQL is flawed in that queries become
exponentially difficult to write as their complexity grows. LINQ scales much
better in this regard. Once you get used to it, it's hard to go back.
2. Database queries are easily composable. You can conditionally add an ORDER BY
or WHERE predicate without discovering at run-time that a certain string
combination generates a syntax error.
3. More bugs are picked up at compile-time.
4. Parameterization is automatic and type-safe.
5. LINQ queries can directly populate an object hierarchy.
6. LINQ to SQL provides a model for provider independence that might really work.
7. LINQ significantly cuts plumbing code and clutter. Without sweeping stuff under
the carpet, like Workflow or Datasets. This is a credit to the design team.
8. C# hasn't suffered in the process (in fact, it's gained).
SQL
A covering index, which is a form of a composite index, includes all of the
columns referenced in SELECT, JOIN, and WHERE clauses of a query.
SQL
Deterministic functions always returns the same output result all the time it is
executed for same input values. i.e. ABS, DATEDIFF, ISNULL etc.
Nondeterministic functions may return different results each time they are
executed. i.e. NEWID, RAND, @@CPU_BUSY etc. Functions that call extended stored
procedures are nondeterministic. User-defined functions that create side effects
on the database are not recommended.
A delegate acts like a strongly type function pointer. Delegates can invoke the
methods that they reference without making explicit calls to those methods.
Delegate is an entity that is entrusted with the task of representation, assign or
passing on information. In code sense, it means a Delegate is entrusted with a
Method to report information back to it when a certain task (which the Method
expects) is accomplished outside the Method's 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.
An abstract class is the one that is not used to create objects. An abstract class
is designed to act as a base class (to be inherited by other classes). Abstract
class is a design concept in program development and provides a base upon which
other classes are built. Abstract classes are similar to interfaces. After
declaring an abstract class, it cannot be instantiated on it?s own, it must be
inherited. Like interfaces, abstract classes can specify members that must be
implemented in inheriting classes. Unlike interfaces, a class can inherit only one
abstract class. Abstract classes can only specify members that should be
implemented by all inheriting classes.
Shared Assemblies: If the assembly is to be made into a Shared Assembly, then the
naming conventions are very strict since it has to be unique across the entire
system. The naming conventions should also take care of newer versions of the
component being shipped. These are accomplished by giving the assembly a Shared
Name. Then the assembly is placed in the global assembly cache, which is a folder
in the file system reserved for shared assemblies.
ADO.NET features:
1. Disconnected Data Architecture
2. Data cached in Datasets
3. Data transfer in XML format
4. Interaction with the database is done through data commands
CLR is .NET equivalent of Java Virtual Machine (JVM). It is the runtime that
converts a MSIL code
into the host machine language code, which is then executed appropriately. The CLR
is the
execution engine for .NET Framework applications. It provides a number of
services, including: �
� Code management (loading and execution)
� Application memory isolation
� Verification of type safety
� Conversion of IL to native code.
� Access to metadata (enhanced type information)
� Managing memory for managed objects
� Enforcement of code access security
� Exception handling, including cross-language exceptions
� Interoperation between managed code, COM objects, and pre-existing DLL's
(unmanaged code
and data)
� Automation of object layout
� Support for developer services (profiling, debugging, and so on).
A delegate acts like a strongly type function pointer. Delegates can invoke the
methods that
they reference without making explicit calls to those methods.
Delegate is an entity that is entrusted with the task of representation, assign or
passing on
information. In code sense, it means a Delegate is entrusted with a Method to
report
information back to it when a certain task (which the Method expects) is
accomplished outside
the Method's class.
User control
1.Compiled at runtime
2.HTML design (Visual design possible)
3.ASP.Net page model with code behind
4.Needs ASP.NET .aspx page to exist (can be used)
5.No design time interface
(Only a box representing the user control is available on an .aspx page)
6.Cannot be added to the ToolBox
.NET does not encourage the development of COM components and provides a different
solution to making reusable components through Assemblies. But, there are a lot of
COM components present which our .Net application might need to use. Fortunately,
.Net provides an extremely simple approach to achieve this. This is achieved by
using �Wrapper Classes� and �Proxy Components�. .Net wraps the COM component into
.Net assembly technically called �Runtime Callable Wrapper� or RCW. Then u can
call and use your COM component just as a .Net (or C#, if u are using C#)
Assembly.
XSLT is based on template rules which specify how XML documents should be
processed. An XSLT processor reads both an XML document and an XSLT style sheet.
Based on the instructions the processor finds in the XSLT style sheet, it produce
a new XML document. With XSLT we can also produce HTML or XHTML from XML document.
With XSLT we can add/remove elements and attributes, rearrange and sort elements,
hide and display elements from the output file. Converting XML to HTML for display
is probably the most common application of XSLT today.
The terms "deep copy" and "shallow copy" refer to the way objects are copied.
VB.NET/C#.NET Languages
CTS
CLS
Web Forms/window Forms/Console
Framework Class Library
ADO.NET
CLR
OS
The MyBase keyword behaves like an object variable referring to the base class of
the current instance of a class. MyBase is commonly used to access base class
members that are overridden or shadowed in a derived class. In particular,
MyBase.New is used to explicitly call a base class constructor from a derived
class constructor.
You can't have a overload method with same number parameters but different return
type. In order to create overload method, the return type must be the same and
parameter type must be different or different in numbers.
You cannot override a non-virtual or static method. The overridden base method
must be virtual, abstract, or override.
Property - Attribute of Object - like User -> Name, Email, Address, Country.....