Welcome to AspAdvice Sign in | Join | Help

Browse by Tags

All Tags » .net   (RSS)

.NET Predicates

YourGenericListOfInts.RemoveAll( new System. Predicate < int >( delegate ( int val) { return (val == r.Index); })); A predicate is a function that returns true or false and can be used for example to filter your results.. For example your .NET RemoveAll(...)
Posted by salibhai | 1 Comments
Filed under: , ,

.NET Advice now SharpDeveloper

I decided to open up shop at my own domain - SharpDeveloper.NET Check it out! Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it! Sponsor
Posted by salibhai | 0 Comments
Filed under: ,

Creating SqlParameters Best Practices

*NEW* See the updated post at Sharp Developer: Sql Parameters Best Practices This article summarizes some nice ways to create SqlParameter arrays. When we use SqlHelper, or even without SqlHelper when we use SqlCommands directly, and we want to pass an
Posted by salibhai | 6 Comments

Using ?? and casting To Set Default Values

Often we have some value that may or may not be null, and we want to give it a default value if its null. An awesome way to do this is to use ?? (only works in C#) and add your default value, and cast the entire thing, for example as follows: string strCustomerName
Posted by salibhai | 0 Comments
Filed under: , , ,

Don't eat exceptions

This is very bad! try { //do something that will throw an exception, like try to commit data to a database with malformed sql } catch { //sweep the dirt under the rug ;) } Consequences/Results - Your boss will not see any exceptions or code crashes, but
Posted by salibhai | 0 Comments
Filed under: ,

Use .TryParse instead of Try {} Catch {}

In certain conditions, we should not be using exceptions. For example, Try Catch blocks can be avoided in certain cases. If you have some .NET 1.0 code, you might not be taking advantage of .NET 2.0 new TryParse functions, which avoid exception handling
Posted by salibhai | 1 Comments
Filed under: ,

Use String.Format instead of Chopping Strings

Here is a quick example of why string.Format is just so cool Here is a quick example of why string.Format is just so cool For example: text1.Text = string .Format( "<a href=\"Mylink.aspx?abc=0&Color={0}\">my Link text</a>"
Posted by salibhai | 0 Comments
Filed under: ,

3 Benefits of Using ConnectionStrings Instead of AppSettings

With .NET 1.0, we are using .AppSettings In .NET 1.0 we used ConfigurationSettings instead of ConfigurationManager Read the article on SharpDeveloper.net Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it! Sponsor
Posted by salibhai | 2 Comments
Filed under: ,