Click here to Skip to main content
15,881,173 members
Home / Discussions / C#
   

C#

 
Generaldirectory chooser dialog Pin
Ylno28-Jan-08 12:56
Ylno28-Jan-08 12:56 
GeneralRe: directory chooser dialog Pin
darkelv28-Jan-08 13:03
darkelv28-Jan-08 13:03 
GeneralRe: directory chooser dialog Pin
Ylno28-Jan-08 13:19
Ylno28-Jan-08 13:19 
Generalthis is a test Pin
Member 462175228-Jan-08 12:25
Member 462175228-Jan-08 12:25 
Generalsdfasdf Pin
Member 462175228-Jan-08 12:19
Member 462175228-Jan-08 12:19 
Questioncan you give me a reference to do it (write CD) ? Pin
B.A28-Jan-08 11:46
B.A28-Jan-08 11:46 
GeneralMethod overloading! Pin
Spykraft28-Jan-08 11:18
Spykraft28-Jan-08 11:18 
GeneralRe: Method overloading! Pin
Ed.Poore28-Jan-08 12:32
Ed.Poore28-Jan-08 12:32 
You can if you're using the C# 3.0 compilers (i.e. VS2008), note that because .NET 3.x uses the same CLR as 2.0 the compiled code can also run on .NET 2.0 but you need the newer compilers.

You can do this using something called extension methods, in your example you'd have to create a class such as:
namespace System
{
    public static class CharExtensionMethods
    {
        public static bool IsDigit(this char c, string str, int i, int n)
       {
            // Checks n chars starting from i in str if they are digits
            /* note that here you can get a reference to the character object you're dealing with through the c parameter */
       }
    }
}
You might be wondering why I've included it in the System namespace, this simply means that you don't need to import a custom namespace to access the extension method in any of your classes where you'll use it.  E.g. if you'd put it in a different namespace such as PooreDesign.ExtensionMethods then your code which uses it would have to be such:
using System;
using PooreDesign.ExtensionMethods;

namespace ConsoleApplication1
{
    static class Program
    {
        [STAThread]
        private static void Main(string[] args)
        {
            bool isDigit = char.IsDigit(args[0], 0, 5);
       }
    }
}
Check out this blog post[^] on how to enable Extension methods in .NET 2.0



GeneralRe: Method overloading! Pin
Spykraft28-Jan-08 13:47
Spykraft28-Jan-08 13:47 
GeneralRe: Method overloading! Pin
PIEBALDconsult28-Jan-08 15:07
mvePIEBALDconsult28-Jan-08 15:07 
GeneralRe: Method overloading! Pin
Ed.Poore28-Jan-08 21:49
Ed.Poore28-Jan-08 21:49 
GeneralRe: Method overloading! Pin
PIEBALDconsult28-Jan-08 12:57
mvePIEBALDconsult28-Jan-08 12:57 
Generalcrystal report formula Pin
shabonaa28-Jan-08 10:48
shabonaa28-Jan-08 10:48 
QuestionObjectStream Pin
BaraMustafa28-Jan-08 8:31
BaraMustafa28-Jan-08 8:31 
GeneralRe: ObjectStream Pin
led mike28-Jan-08 8:53
led mike28-Jan-08 8:53 
GeneralRe: ObjectStream Pin
Skippums28-Jan-08 8:56
Skippums28-Jan-08 8:56 
GeneralManaged COM, static constructors, and paths Pin
Dan Neely28-Jan-08 8:08
Dan Neely28-Jan-08 8:08 
GeneralRe: Managed COM, static constructors, and paths Pin
Skippums28-Jan-08 9:14
Skippums28-Jan-08 9:14 
GeneralRe: Managed COM, static constructors, and paths Pin
Dan Neely28-Jan-08 10:35
Dan Neely28-Jan-08 10:35 
GeneralMessage Closed Pin
28-Jan-08 8:00
Member 462175228-Jan-08 8:00 
GeneralRe: test Pin
Member 462175228-Jan-08 8:02
Member 462175228-Jan-08 8:02 
GeneralRe: test Pin
Ennis Ray Lynch, Jr.28-Jan-08 8:06
Ennis Ray Lynch, Jr.28-Jan-08 8:06 
GeneralRe: test Pin
Member 462175228-Jan-08 8:07
Member 462175228-Jan-08 8:07 
GeneralRe: test Pin
Member 462175228-Jan-08 8:24
Member 462175228-Jan-08 8:24 
GeneralA window opening problem Pin
DSdragondude28-Jan-08 7:54
DSdragondude28-Jan-08 7:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.