Search

You searched for the word(s): userid:613100

Matching Posts

  • Re: constructor is inheritable in c#

    No (the links provided by Swagat actually support this - I'm not sure why he answered 'yes')
    Posted to C# (Forum) by David Anton on 12/28/2009
  • Re: constructor is inheritable in c#

    Yes - but even this is nothing to do with 'inheriting' a constructor - it's just making a call to the base class constructor before any derived class constructor logic occurs.
    Posted to C# (Forum) by David Anton on 12/28/2009
  • Re: constructor is inheritable in c#

    SGWellens: If the constructor wasn't inherited, you wouldn't be able to call it. If this were true, then you'd be able to have: DerivedClass d = new DerivedClass(x); if the base class had a single parameter constructor (of the type of 'x'), even if DerivedClass declared no constructors. But of course you can't - this is related to the OP's question. 'DerivedClass' must have the same constructor signature declared explicitly - there is no seamless call to the base
    Posted to C# (Forum) by David Anton on 12/28/2009
  • Re: Dice rolling.

    Yes, you need "New Random(1, 7)" since the second argument is exclusive, not inclusive. I overlooked this in my post.
    Posted to Visual Basic .NET (Forum) by David Anton on 12/24/2009
  • Re: Dice rolling.

    Don't use two separate 'Random' variables: (And what the heck is "Randomize" there for? That should only be if you're using the VB-specific routines). Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim R As New Random Dim d1result As Integer = R.Next(1, 6) Dice1.Text = d1result.ToString Dim d2result As Integer = R.Next(1, 6) Dice2.Text = d2result.ToString End Sub
    Posted to Visual Basic .NET (Forum) by David Anton on 12/24/2009
  • Re: Problem Converting From C# to VB (HttpRuntime.Insert...)

    'AddressOf' isn't a method call - it's an operator, so don't use parentheses: HttpRuntime.Cache.Insert(_cacheDependencyName, New Object(), dependency, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.NotRemovable, New CacheItemRemovedCallback(AddressOf OnSiteMapChanged))
    Posted to Visual Basic .NET (Forum) by David Anton on 12/23/2009
  • Re: Convert C# statement to VB.NET

    This functional programming technique (of which I'm certainly not a fan) involves specifying a method body inline which will be executed subsequently, but not necessarily immediately. Personally, I don't see how this adds clarity to a program. Our converters label the extracted method "Anonymous..." since the technique in C# is often referred to as an "anonymous method". If you really like this sort of stuff, then you'll probably find F# very appealing - along with
    Posted to Visual Basic .NET (Forum) by David Anton on 12/23/2009
  • Re: Convert C# statement to VB.NET

    VB9 (VS 2008) : async.PostOperationCompleted(Function(e) AnonymousMethod1(e), completedArgs) Private Function AnonymousMethod1(ByVal e As Object) As Object OnMyTaskCompleted(CType(e, AsyncCompletedEventArgs)) Return Nothing End Function VB10 (VS 2010): async.PostOperationCompleted(Sub(e As Object) OnMyTaskCompleted(CType(e, AsyncCompletedEventArgs)), completedArgs)
    Posted to Visual Basic .NET (Forum) by David Anton on 12/23/2009
  • Re: VB to C# - subroutines

    You should really start another thread. The method is just called as: Addition(); A 'void' method must be called this way, while a non-void method is usually called by assigning the result to something else (but you don't have to assign the result).
    Posted to C# (Forum) by David Anton on 12/21/2009
  • Re: Explicity Destroying Objects

    Unlike VBA (or VB6), there is no need to explicitly set any local variables to 'Nothing' - when they go out of scope the GC will know that they can be collected if there are no other references to the object - setting to 'Nothing' would just tell the GC the same thing, so there's no need.
    Posted to Visual Basic .NET (Forum) by David Anton on 12/19/2009
Page 1 of 45 (442 items) 1 2 3 4 5 Next > ... Last »