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 6 and 7 and type the answer here:
  • Post
  • I just have a couple of productivity questions regarding intellisense.

    Is it possible when you type {, (, [, etc. to have the IDE automatically insert the corresponding }, ), ] etc.? Does this exist in VS.NET 2003? Am I just blind?

    Would it be possible to have intellisense insert the beginning of the text when list values are the same?

    Example:

    If you type

    System.AppD

    and intellisense displays

    System.AppDomain
    System.AppDomainSetup
    System.AppDomainUnloadedException

    could the IDE automatically expand it to

    System.AddDomain

    or possibly if you just hit tab to select AppDomain leave the intellisense selection up if there are others that match?

  • If I send my program to a friend, he can't start it, even though he has the .NET framwork 1.1 installed, what have I done wrong?
  • How can I do code injection?

    I think I can use the remoting API but I'd like to know if there is a way to inform the compiler to inject code based on an attribute.

    For example, we use a privilege based system. Every function needs a call to get the current user and ask whether or not it has the privilege X.

    [RequiresPrivilege(AppPrivileges.SomePrivilege)]
    public void function(){
    ...
    }


    I could then enforce that every public function also has a privilege attribute set to it.

    I think I can do this at runtime with AppDomains but it feels like it's a big performance hit.

    Will Whidbey solve my problem?

    Thanks

    PS I have a lot of questions regarding the IDE... let me know if they are appopriate here too.
  • Simple productivity question. Why doesn't C# intellisense expand enum values like VB.NET? I'm primarily a C# programmer, but I use VB.NET for some functions, and it's one thing I really miss.
  • A. When, if at all, will there be a CSharpCodeParser implementation?
    B. When, if at all, are you planning on creating a CodeDOM that is language specific, alongside the CLS one?
  • Why does try/catch require curly braces even when there is only a single statement?

    eg. The following is not permitted.

    try
    statement;
    catch
    statement;
  • About C# 2.0:
    why is there a 'new()' constraint for generics (requiring a no-arg constructor in the class), but not a constraint that requires presence of a particular argument signature for a constructor, e.g a constraint 'new(int, string)'. Having a no-arg constructor often means having partially initialized objects around, which in turn requires a check like 'is this object initialized?' in every method.

    And related, is there any hope of being able to define a constraint requiring the constrained class to have a static method with a particular name and signature? (you cannot use interfaces for static method constraints, of course).
  • Why doesn't the IDE (VS2003) allow me to reference an assembly with the extension *.exe? You can select an *.exe in the 'add reference' dialog (*.exe is in the open file dialog filter), but the next thing that happens is that it is refused. The worst part is that there is no reason to refuse it.

    For those of you who are wondering why someone would ever want to import references from an EXE: you may want this ability when developing 'plugin' DLLs.
  • Why doesn't the new Whidbey deployment features work with alternate build tools, such as NAnt?
  • I would really like to see Edit-N-Continue in C#. Yes, I can hear all the anti-ENC crowd starting to bubble up with displeasure at this horrible suggestion that will ruin development as we know it, but let me give you a real life situation that I have. I build large and complex applications. It literally takes several minutes to start the debugger and to get the application running. There is no great buzz-killer than to realize that the problem is because some property is being set to the wrong value or some method is being passed a wrong value or something else stupid. Why should I have to stop the debugger, change the value, restart the debugger, and then go back to the same location within the application? Before someone says, well just leave a web browser up and blah, blah, blah, what happens if the application is a Winforms application?
  • Why aren't there exquivalents for __FILE__ and __LINE__?
  • If I have this...

    string s = "this is a test";

    why couldn't I do this in C#'s immediate window?

    ?s.IndexOf("this")

    I will get "error: 's.IndexOf' does not exist" message. It works in VB.NET.

    I have to wirte my own a generic method if I want to evaluate an expression that contains an object's function.



  • When is the C# team going to implement edit and continue? Do I need to bug every programmer I work with at every contract I take to email the C# team to let them know that all of us want this feature? :-)

    I've said it before and I'll say it again, "The MS Office team puts a billion and one features in their apps that I will probably never use all in the name of ROI and TCO, and yet one of the most important ROI and TCO features is being implemented by the VB.NET team, but not the C# team." Pretty please with a cherry on top: make Edit and Continue happen in C#!
  • Why is the same keyword used for the using statement and the using declaration?
Page 1 of 14 (196 items) 12345»