Sunday, February 04, 2007

MISC

Hi all.
if you have any doubt in .net .. please comment your doubts here...
Thanks.

7 comments:

  1. what is the regex pattern for 3 digits with hyphen 3 digits like this 79-90. i want to validate one textbox.

    ReplyDelete
  2. hi nithin.
    you just try this code..

    Regex regStr = new Regex(@"^\d{1,3}[-]\d{1,3}$");

    Thanks.

    ReplyDelete
  3. hi.. i need regex exprn to accept all phone numbers.. help me please

    ReplyDelete
  4. hii shafi,

    check this one.

    ^((\+){0,1}91(\s){0,1}(\-){0,1}(\s){0,1}){0,1}98(\s){0,1}(\-){0,1}(\s){0,1}[1-9]{1}[0-9]{7}$

    or

    ^(\([2-9]|[2-9])(\d{2}|\d{2}\))(-|.|\s)?\d{3}(-|.|\s)?\d{4}$


    thanks

    ReplyDelete
  5. Anonymous3:46 AM

    Are constructors the same in C++ and C#?

    ReplyDelete
  6. hiii...

    Although there are strong similarities between C# constructors and C++ constructors, there are, also, some significant differences.

    Firstly, C# supports constructor chaining—one constructor can call another.

    example:
    class Employee
    {
    public Employee (string name, int salary)
    { ... }

    public Employee (string name) : this (salary, 0) {}

    public Employee() : this ("", 0) {}
    }

    Secondly, virtual method calls within a constructor are directed to the most derived implementation.

    Thirdly, error handling is a bit different. When an exception occurs during C# object construction, the destructor—finalizer—will be called. This behavior differs from C++ behavior in which the destructor is not called if construction is interrupted.

    Lastly, C# has static constructors. A static constructor for a class executes before the first instance of the class is created.

    Interestingly, some C# developers—like some C++ developers—prefer the factory pattern to constructors.

    ReplyDelete
  7. Anonymous2:08 AM

    How c# handles object copying? like c++ have a copy constructor

    ReplyDelete