Results 1 to 8 of 8

Thread: C# equivalent to VB.Net's With statement?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2004
    Posts
    308

    C# equivalent to VB.Net's With statement?

    Hey Guys, is there a C# equivalent to the VB.Net With statement please?

    Thanks

    Chubby.

  2. #2
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: C# equivalent to VB.Net's With statement?

    Quote Originally Posted by Chubby
    Hey Guys, is there a C# equivalent to the VB.Net With statement please?

    Thanks

    Chubby.
    No.
    Take a look at this to know why?
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: C# equivalent to VB.Net's With statement?

    There is no equivalent.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2004
    Posts
    308

    Re: C# equivalent to VB.Net's With statement?

    Thanks to all.

    Seems crazy, in the days of VB6 I thought it was implied that regardless of readability, using a With block was faster that accessing the pointer each time you wanted to set a property etc....

    Amusing, the way that the designers "think" a With block is a curse, I for one find it easier readability wise...

    Thanks Again.

    Chubby.

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: C# equivalent to VB.Net's With statement?

    Take a look at this thread.

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: C# equivalent to VB.Net's With statement?

    Quote Originally Posted by Chubby
    Thanks to all.

    Seems crazy, in the days of VB6 I thought it was implied that regardless of readability, using a With block was faster that accessing the pointer each time you wanted to set a property etc....

    Amusing, the way that the designers "think" a With block is a curse, I for one find it easier readability wise...

    Thanks Again.

    Chubby.
    Yes, but you can compare VB 6 to VB.NET or C#.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2004
    Posts
    308

    Re: C# equivalent to VB.Net's With statement?

    Quote Originally Posted by Hack
    Take a look at this thread.
    Very good Thread.

    Thanks for that.

    Chubby.

  8. #8
    Fanatic Member
    Join Date
    Jan 2006
    Posts
    710

    Re: C# equivalent to VB.Net's With statement?

    There's a way to simulate the same sort of problems that 'With' produces:
    http://www.tangiblesoftwaresolutions...0VB%20With.htm
    David Anton
    Convert between VB, C#, C++, & Java
    www.tangiblesoftwaresolutions.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width