/Home /Archive /Syndicate /About /Contact  
CSharpFeeds - All C# Feeds in One Place!





In this article Sandesh discusses the different ways of sorting an array of custom objects in C# using the IComparable and IComparer interfaces. Examples are provided on the simple case of sorting an array of built in data types and extends the example to custom objects. He demonstrates the concepts with the help of code samples along with relevant analysis for each one of them.


This article shows techniques to convert data or issues when working with data conversion and validation. Brian examines the techniques involved in Data and Nullable Type Conversion with the help of code snippets in C#. He also provides an outline of String, Data Type ranges, and the different ways with which you can manipulate data input in ASP.NET.


Yes, it's one of those posts where you either agree or disagree completely :) Anyway, after having a 15 minutes discussion with my friend Paulo (which, btw and as usual, disagrees with me) yesterday at 1AM, I've decided to write this post. The problem: MS recommends that variable names shouldn't have any sort of prefix like the _ or m_ . And what do I think? Well, I don't ... [ read more ]


Ok, so you already know the answer, right? That’s why the String class has the Contains method. And it will work until you need to explicitly need to use a different StringComparison option than the one that is used by default. If like me, you know that Reflector is your friend, then you can just open it and see how the Contains method is implemented. Basically, what you need is a ne ... [ read more ]


Oren has a post showing how he deals with time sensitive code in his unit tests .  One thing that's interesting is that, like my previous post, deals with the System.Func<T> construct introduced in .NET 3.5.  I see this convention more and more and it's really growing on me.  I've dealt with timing issues in my own code using a convention similar to the one Ayende demonstr ... [ read more ]
Karl Seguin has an interesting post about using System.Func to fight repetitive code blocks , which actually addresses a pain point I've had for quite some time but had never acted on to fix.  Whenever one access the Cache or a similar statebag that might or might not contain the value sought after, it is important to check if the value exists first, and if it doesn't, go and retrieve it ... [ read more ]
Value types and reference types are important concepts in C#. In this article, Brendan describes these concepts in an easy way. This beginners' tutorial is written to help people unfamiliar with these concepts to gain a basic understanding of them.


This question came up on an internal C# alias, and I thought the answer would be of general interest. That's assuming that the answer is correct - it's been quite a while. The .NET IL language provides both a call and callvirt instruction, with the callvirt being used to call virtual functions. But if you look through the code that C# generates, you will see that it generates a "callvirt" even ... [ read more ]
I'm strongly considering adopting the use of an IsNull extension method in my .NET 3.5 coding projects.  A quick search to see what others have to say about this revealed a new web site dedicated to extension methods , which includes this IsNull method ready to go: pubic static bool IsNull( this object source) { return source == null ; } The String class supports t ... [ read more ]


Example Code. Some time back I wrote about techniques for implementing non-deterministic finite automata (NDFAs) using some of the new features of C# 3.0. Recently I’ve had a need to revisit that work to provide a client with a means to generate a bunch of really complex state machines in a lightweight, extensible and easily understood [...]


I’m still not understanding why it won’t give me a warning when I create an internal class with a public method. Here’s an example: class MyInternalClass{    public void Test(){} //no compiler warning } Ok, at the end of the day, Test is really an “internal” method since the acessibility of a member can never be greater than the one of i ... [ read more ]


I want to start this by discussing the purpose of method type inference, and clearing up some potential misunderstandings about type inference errors. First off though, a brief note on nomenclature. Throughout this series when I say "type inference" I mean "method type inference", not any of the other forms of type inference we have in C# 3.0. (Implicitly typed locals, implicitly typed arrays ... [ read more ]


The ASP.NET MVC team developed a URL routing engine, similar to the engine in Rails, which has made it’s way into the rest of ASP.NET. ScottGu has covered it a few times in the past, and this post has some good examples of it. Here’s a quick example: routes.MapRoute("ShowProductByCategory", "Products/Show/{Category}/{id}", new { controller [...]



All feed content is property of original publisher. Designated trademarks and brands are the property of their respective owners.