Feeds:
Posts
Comments

Archive for the ‘.NET’ Category

In order to use regular expressions in .NET framework System.Text.RegularExpressions namespace could be used. The following link contains more information about this namespace:

http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.aspx

Read Full Post »

To add line numbers to visual studio files follow these steps:

  1. Select Tools menu and Options

1

 

2. In the Options window, select Text Editor and All Languages from the left hand menu

2

 

3. Check the Line numbers box option

3

 

4. Click OK

4

Read Full Post »

Nullable Modifier

By default reference types are the only ones that could get assigned a null value. However, sometimes it is important to set a null to a value type. In this case C# has a feature that could be used to get around this issue. This feature is called nullable modifier. Adding ? symbol after the value type will make the data type to nullable type. For example if you have an integer which is a value type and you don’t have a specific value to assign to it, it could be set to a nullable type:

int? studentID = null;

This feature is handy in readying the values from database for the fields that could be set to null in database.

This link explains about nullable modifier as well:http://msdn.microsoft.com/en-us/library/1t3y8s4s(v=vs.80).aspx

Read Full Post »

There are three principals used in object-oriented-programming:

  • Encapsulation: This concept allows hiding details in programming. Basically you know the bigger picture of what’s happening and not the details of exactly what is being done. In addition, encapsulation means to enclose a set of items into a capsule.
  • Inheritance: this concept in OOP is referred to as “is a” concept. In other words Toyota “is a” car, so is Audi. They both have similar features that are shared between them but also have extra features that are different in each. In this case a basic car class could be implemented and have Toyota and Audi car that drive from basic car. In other words we have a base class (car) and we have special classes (Toyota and Audi). The special classes are known as drivers. This concept will be covered in next module.
  • Polymorphism: means “many forms”. It is when the derived classes (special classes) share the same function but the details in performing the action is different in each class. For example if we have a sport base class and we have football and baseball drivers (special classes); there is a method Play that both drivers (football and baseball classes) are going to have but the way to play football and baseball is different (i.e. the underneath details differ). In this case the base class will have the method Play without implementation then each driver classes will implement the details based on their types. The following link explains more about this concept. http://msdn.microsoft.com/en-us/library/ms173152.aspx

Read Full Post »

The ref parameter have to be initialized before getting passed into a function whereas out parameter does not have to be initialized before getting passed into a function.

Read Full Post »

Here are advantages and disadvantages of Flash:

Advantages of Flash:

  • Most successful plug-in adobe flash
  • Is installed on over 90% of web browsers
  • Flash has long history
  • Flash is straightforward tool for adding animated graphics

Disadvantages of Flash:

  • Flash requires separate design tool, programming language, and programming environment
  • No straightforward way to integrate flash with server-side .net code

What Silverlight can offer compared to Flash:

Silverlight’s goal is to combine power and cross-platform support of Flash with .NET. Therefore, client-side code and server-side code is in the same language. Hence, for .NET developers Silverlight is more convenient and powerful for internet applications. However the clients’ need to download a onetime plug-in to be able to view Silverlight based websites.

Read Full Post »

Recently I had to find out what process is using a specific port number on a machine. Here are the steps and commands I used:

  • Open a command window
  • Machine’s IP address – use ipconfig command to find machine’s IP address
  • Port’s process ID – to find the process id for a specific port number use this command: NetStat –o –n –a | findstr <machine’s IP Address>:<port number>

The last number is the process number which is going to be used in finding the application

  • Application’s name – to find out the application’s name from last step’s process ID, use the following command: TaskList  /FI “PID eq <processID from last step>” /FO LIST /V

Read Full Post »

In .NET 4, managed code does not catch exceptions raised by corrupted process such as Access Violation. There is a configuration setting that could be set in application’s config file to change this behavior. This configuration is legacyCorruptedStateExceptionPolicy; by setting it to true it allows these exceptions to be caught. Here is how to set legacyCorruptedStateExceptionPolicy configuration in config file:

 

This link contains more information in this regard:

http://msdn.microsoft.com/en-us/library/dd638517.aspx

Read Full Post »

This is when you have a data member in an object, but you want to ensure that the data member cannot be set out side of the class.  For example, there is a Person class that contains FirstName and LastName members:

 

Let’s say for some reason you want to make LastName a read only member. One way is to delete the set property for LastName. Another method is to make the set property private:

 

This will ensure that the LastName is read only member.

Read Full Post »

This is when you need to add a name space to a class to use the name spaces’ defined members or functions. For example in a class that needs to use List the using System.Collections.Generic; is needed. .NET has a Resolve right click option that can be used to add the using automatically. Simply in the file type List, then from the right click menu select Resolve –> using Sysmte.Collections.Generic; option.

After that the name space will be added:

Read Full Post »

Older Posts »