Feeds:
Posts
Comments

Posts Tagged ‘C#’

Microsoft has ramped up the security in their latest operating system – Windows Vista, which means that developers now have to pay more attention to certain security constraints imposed by the operating system when developing applications.   Those of you readers who have read my prior posts on User Access Control in Vista (and the further reading [...]

Read Full Post »

Pass by Reference

Contrary to the beliefs of some developers, .Net reference types do not need to be passed as reference parameters (ref in C#, ByRef in VB) when a method is going to alter the contents of an object instance.
Passing a object reference by reference parameter just means the method can reassign the reference to a new [...]

Read Full Post »

Just because it’s good to know…..

Keyword

Class

Range

bool

System.Boolean

true and false

byte

System.Byte

0 to 255

sbyte

System.SByte

-128 to 127

short

System.Int16

-32768 to 32767

ushort

System.Uint16

0 to 65535

int

System.Int32

-2,147,483,648 to 2,147,483,647

uint

System.UInt32

0 to 4,294,967,295

long

System.Int64

-9,223,372,036,854,775,808 to
9,223,372,036,854,775,807

ulong

System.UInt64

0 to 18,446,744,073,709,551,615

decimal

System.Decimal

-79,228,162,514,264,337,593,543,950,335
to 79,228,162,514,264,337,593,543,950,335

double

System.Double

-1.79769313486232e308 to
1.79769313486232e308

float

System.Single

-3.402823e38 to 3.402823e38

char

System.Char

0 to 65535

Read Full Post »

To some I may be stating the obvious, but today I was happy to find out that C# lets you set a different access level on the get and set for a property. The example below will help to illustrate what I’m talking about:
public DateTime UpdateDate
{
get
{
[...]

Read Full Post »

From C++ to C#

I have gone back in time this week to work on a legacy ISAPI
application.  The ISAPI application is being developed in C++ and
makes use of MSXML to read an XML configuration file.  Below is
some code in C++ to open the XML file and read two text values,
contained in element nodes:
BOOL GetConfigDetails(string &userName, string &domain)
{
BOOL result [...]

Read Full Post »

The saying goes “you learn something new every day”, and today is no
exception.  I’m not sure how I missed this, but never less, this
post shows how to gain finer control over adding and removing of event
handlers to public multicast delegate events.
Typically, most C# developers are used writing event code as follows:
using System;
public delegate void MyDelegate(); [...]

Read Full Post »

Another nice addition to C# 2.0 is the yield keyword. Yield enables iterator blocks to provide values to an enumerated result, see the following example.
// yield-example.cs
using System;
using System.Collections;
public class List
{
public static IEnumerable Power(int number, int exponent)
{
int counter = [...]

Read Full Post »

I was reading about Nullable Types in the C# 2.0 specification for the
.NET Framework 2.0 today. I am surprised I didn’t find out about this
feature long ago, goes to show that you learn something new every day.
So what are Nullable Types?
Simply put, Nullable Types are value types that a can be assigned null. The following [...]

Read Full Post »

I am currently writing an ASP.NET server control, which exposes a
number of custom events.  I was looking through my code archives
for a helper class, which will safely call handler methods of a
multicast delegate, when an event is triggered.  I found the class
I was looking for, and decided to publish it here on my blog for [...]

Read Full Post »

I have lost count of the number of times that I have been asked to work
on a piece of software written by another developer, only to find out
that the code had no comments. What typically follows is hours spent
wading through lines and lines of complex instruction to determine how
the software was intended to work before [...]

Read Full Post »

Older Posts »