Home > Categories > C#
Page 1

A basic Database Abstraction Layer

Introduction In a previous tutorial, we created an abstract class for basic SCRUD database operations. Today we're going to build on that to create a generic database abstraction layer (DAL). The aim of this is to allow you to connect to any database type without having to worry about changing your Data Layer classes. We're also going to be introducing 2 of the most common design patterns. Factory Singleton First download the previous tutorial source code from here. We'll be creating 2 new classes for...
Read more

A basic database SCRUD class using abstract and generic modifiers

Introduction SCRUD is short for Select, Create, Read, Update and Delete. These are the general actions that any program will perform when working with databases. Yes, there are plenty of ORM applications ( http://en.wikipedia.org/wiki/Object-relational_mapping ) out there that can replace this, but as a general introduction to abstract or generic classes and general development I still think this is worth a read. I should also explain why I have used an abstract class instead of an interface....
Read more

5 Differences Between C# and Java: Objects and Classes

One of the most important aspects of C-derived languages is object orientation. Objects and classes allow programs to specify methods and variables in one portion of code and use them again wherever necessary. While the basic structures of class construction remain consistent between C# and Java, some subtle differences my cause problems for developers unaccustomed to the idiosyncrasies between the two languages. #1: Instance-level inner classes C#: Work-around support Instance-level inner...
Read more

5 Differences Between C# and Java: Data Types

The line between desktop development and web-based applications has been all but obliterated in the last few years. With the advent of smartphones, especially Google’s Java-based Android operating system, developers are scrambling to jump onto the newest technology, while fearing that the skills they have cultivated over the years may become obsolete. Many former C++ and C# programmers are migrating their way to Java applications. While the languages are remarkably similar (as Java was built...
Read more

5 Differences Between C# and Java: Methods

One of the biggest difference between C# and Java is how they handle methods. In both languages, methods are the building blocks of functional code: they define the variables, specify the operations carried out on those variables, and can return values to be used in other methods. Although the creators of the Java language followed many of the concepts of C-based languages, their development of methods allowed for fewer restrictions and more flexibility. #1: Virtual Methods C#: Methods are non-virtual...
Read more

Make Legacy VB 6 Components Work With .NET Applications

Most IT professionals do not work in state of the art design shops with all the latest developer suites available to them. Many of us have to make older applications and components work with newer technologies.  I found myself in this predicament last year when I was required to make a new ASP.NET (3.5) web application work with a ten year old VB6.0 COM Plus Component. When I suggested to management that I re-write the component, they said:  There’s no time. I know you can make it work. By the way, we need...
Read more

Common C# Build-Time Errors Part II: Inheritance and Interfaces

In our last lesson, we saw many of the most basic build-time errors in C#. In this session, we will look at some of the errors related to: classes subclasses inheritance Once we address some of the more common errors we will take a look at how you can fix them. #1 Hidden Method Name Creates Overload This conflict arises when a base class and its subclass have a function of the same name public class MyBaseClass { public void Function() { // function code goes here } { public class MySubClass : MyBaseClass { public...
Read more

Common C# Build-Time Errors: Part I

Here’s the situation: You’ve written a program in C#. You’ve checked the flowcharts, examined your coding and developed your user interface. You’re anticipating that everything will flow as smooth as silk. You’re ready to create a build of the program and, instead of seeing a beautiful, efficient result, you get several (often incomprehensible) error message. How did this happen? Here are SOME ways that these errors occur: #1 Undeclared Variables C# throws an error message on undeclared...
Read more