Some notes on software development... RSS 2.0
# Thursday, 07 February 2008
Thursday, 07 February 2008 10:35:36 (GMT Standard Time, UTC+00:00)  #    -
C#

This is a handy operator that can be used to replaces 'if-else' syntax therefore producing less code.
The operator is used in the form:

condition ? first_expression : second_expression;

If the condition is true then the first_expression is returned. If the condition is false the second_expression is returned.

For example:

if (string.IsNullOrEmpty(_name))
{
  txtName.Text = "";
}
else
{
  txtName.Text = _name;
}

can be re-written using the ternary operator like so:

txtName.Text = string.IsNullOrEmpty(_name) ? "" : _name;


Links:

MSDN ?: Operator (C# Reference)

Thursday, 07 February 2008 09:34:49 (GMT Standard Time, UTC+00:00)  #    -
C#
# Tuesday, 05 February 2008

If you need to match a single word from a range of words you can use regular expression Alternation. This syntax uses the pipe (|) to represent the logical OR for matching. Here is a RegEx that only matches on 1 of the 4 words (depending on case sensitivity):

^(word1|word2|word3|word4)$

If you need to also allow a possitive macth on an empty string you can and another pipe (|) with no word after like so:

^(word1|word2|word3|word4|)$

This will match a blank word or either of the words listed.

Tuesday, 05 February 2008 11:40:22 (GMT Standard Time, UTC+00:00)  #    -
Regular Expressions
# Monday, 04 February 2008

Microsoft Visual Studio 2005 ships with a useful collection of Windows images & icons that can be used with your applications to keep a consistent look and feel with other Windows applications.

For a default installation the zip file VS2005ImageLibrary.zip is located in the folder: C:\Program Files\Microsoft Visual Studio 8\Common7\VS2005ImageLibrary

The images and icons are categorised in to sub folders and each folder contains a very useful Readme.html file that will render the animated images and icons in a browser.

For further info see the MSDN page here: Visual Studio 2005 Image Library

Monday, 04 February 2008 09:19:29 (GMT Standard Time, UTC+00:00)  #    -
Visual Studio
Navigation

Sign In
Extras
Statistics
Total Posts: 116
This Year: 0
This Month: 0
This Week: 0
Comments: 36
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2018
Hadrian Phillips

All Content © 2018, Hadrian Phillips
DasBlog theme 'Business' created by Christoph De Baene (delarou)