Ask a FAQ Question

Ask a FAQ Question

Rate This

Do you have a FAQ about:

  • The C# Language or compiler
  • The C# IDE
  • The Visual Studio debugger

Reply to this post, and your question will be added to our list to be answered. Of course, depending on the nature of your comment, and the volume we receive, we may not get to every question.

Note that if your question is not about C# specifically (if it is, for example, a Windows Forms question or a general question about the .NET Framework), it would be better to post that question to a newsgroup or web forum. Visit http://msdn.microsoft.com/vcsharp/community/ for a listing of related resources.

Thanks!

Leave a Comment
  • Please add 8 and 7 and type the answer here:
  • Post
  • This question is regarding the usage of Finalize() and Dispose(). How do u choose which one to use?? Dispose() clears up any managed and unmanaged resources anyway, so when do u have to actually use Finalize(). Finalize() has a extra overhead too as it has to be handled in a different way by the CLR. So how can u justify the usage of Finalize() in a situation?
  • what's the difference between asynchronous call and synchronous call?
    I was pretty much confused when reading such words from Don Box's book <Essential.Net Volume.1>:
    <quotes>
    IAsyncResult has four members.The CompletedSynchronously property indicates whether or not execution took place during BeginInvoke.Although the CLR's asynchronous invocation plumbing will never do this, objects that implement asynchronous methods explicitly may elect to process an asynchronous request synchronously.
    </quotes>
    a couple of things confuse me here,for one thing,what actually plumbing is,and second,how to understand thoses words "process an asynchronous request synchronously".
  • Why was DateTime created as a value type rather than a reference type? Making it a value type foreces everyone to find an alternative. Try Googling for "nullable DateTime C#".

    Anyone who has ever worked with dates knows that they are frequently unassigned, so I assume that there's a well thought-out reason. The only thing that I've been able to come up with is the efficient memory allocation when used in arrays.
  • Why does C# doesn't allow to call an instance method inside a class declaration instead of method declaration?
  • When are you going to release C# 2.0 ?
  • can I write and deploy applications using visual C# standard edition professionaly? with out buying Visual Studio which is costly compared to C# alone
  • I am running win89. I downloaded dotnetfx.exe
    Douldle clicking asks if I want to install netframework1.1 It extaracts and says it needs to update windows installer momponents before setup can continue. ask if i want to procede. i say yes and it tells me that setup cannot contuinue . it cannote access windows installer components. setup cannot contine. how do i fix this??? please reply
    doorknob@nt.net
  • Why doesn't c# have late-binding of methods ?

    i.e. consider the code:
    void process(string s){
    Console.WriteLine("string called");
    }
    ///
    ///
    void process(object o){
    Console.WriteLine("object called");
    }
    //
    //
    void testBinding(){
    object obj = "string";
    process(obj);
    // result is "object called";
    }

    in java the result is "string called", why doesn't c# recognise the RTT of the object and adjust to call the appropriate method.
  • Why we can not define fields in an interface???
  • Sometimes, when I need to assign optional fields to the database, these fields will receive null... Most of them are datetime types... So I pass a DateTime as a parameter, but since it is a Value Type, I can't assign null to the variable...

    So I declare it as an object...
    If the value will be passed, I instatiate it as an DateTime, and pass as a SqlParameter.. If don't, I just assign Convert.DbNull to the variable...

    The first question here is, how good is that practice? The another is structurally, how the C# addresses that? Objects are Reference Types right? So, when I assign a Value Type, then the boxing comes in hand... But what the object variable really holds? The object becomes a value-type? How he's stored?

    Thanks!
  • Is there any equivalent to Vb.Net MyBase.New, to call the base class constructors?

    Suppose a simple sample, I want to create an custom Exception, derived from the Exception Class... And I have my messages enumerated...

    Acordling to the ErrorMessage I received, I load an Error string into Exception Message, and load some other custom fields a created for my Class...

    In VB.Net I would do the following...

    ----------------------------

    Public Enum ErrorMessages
    Message1
    Message2
    End Enum

    Public Class MyException
    Inherits Exception

    Public Sub New(message As ErrorMessages)
    Select Case (message)
    Case ErrorMessages.Message1
    MyBase.New("This is the Error #1")
    ' Do some specific Login here
    Case ErrorMessages.Message2
    MyBase.New("This is the error #2")
    ' Do some specific Logic here
    End Case
    End Sub
    End Class

    ----------------------------

    Don't know how could I do this in C#... Because the only way I know to call the base constructor is overriding it, wich means that it'll have the same set of parameters of the base constructor...
    Is there a way to reach that in C#?

    Thanks..
    Rafa®
  • According to a article (I think from Eric) it seems that Direct call is way too much faster than delegates, or even interface castign calls.

    I have 2 questions
    1. Why is interface casting so slow
    eg
    ISomething s = (ISomething) obj;
    s.Execute();

    2. What would be the performance of making a an abstract class and them implementing the abstract method. Then calling the method via the base class.
  • A hashtable created the "normal" way, with the default constructor, will call the GetHashCode() and Equals() methods of the keys inserted into it.

    However, a hashtable constructed with IHashCodeProvider and IComparer arguments puts more of a burden on the programmer. Specifically, the contract for IComparer.Compare(a,b) requires an ordering test rather than an equality test: it has to return a result indicating whether a is less than, equal to, or greater than b; not simply whether a equals b. There are many cases where a class can have a notion of equality but not of ordering.

    Why this assymetry? Shouldn't the second parameter be something like an "IEqualProvider" rather than IComparer? The implementation of Hashtable obviously doesn't need an ordering test.
  • I meant for this to be my subject line. :-)
  • I would like to know how to fix my color pixels on monitor and please don't tell me to follow the help because I have been through them steps so many times that I know them by heart what I really want to know is there a fix it program or does any one have any ideal on how to fix this problem because I have been on this for a month.The slider will not work to where I can change the pixels in my display area so please if any one can help I would be very greatful because I don't have the money to pay to have it fix the computer was gave to me so I am trying to fix it my self

    Thank you
    Sandy Pegram
Page 6 of 13 (195 items) «45678»