Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

AEternal

@AEternal
About
Posts
10
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Two Coding Horrors I overheard today...
    A AEternal

    :( Is nowhere safe!?

    The Weird and The Wonderful database sql-server sysadmin help

  • why o' why?
    A AEternal

    Oh my FREAKING God.... That makes me twitch. That's such a horrible security flub.

    The Weird and The Wonderful question

  • Horror, or not?
    A AEternal

    I believe it is. You're leaving data integrity up to the USERS! Are you kidding me!? :omg: Data integrity is everything. You can always index and perform other optimizations if you want to speed things up, even throw hardware at it if necessary, but fixing corrupted data is a nightmare with no easy solution. Given the horsepower of modern systems, there's no excuse for not using this important feature.

    The Weird and The Wonderful database question com tools xml

  • Bool expression??
    A AEternal

    Fair enough. :)

    The Weird and The Wonderful csharp linq functional question

  • Bool expression??
    A AEternal

    It's not THAT horrible. Yes, it's not exactly elegant, but sometimes this is done to make things clearer to other coders (especially less-experienced ones).

    The Weird and The Wonderful csharp linq functional question

  • OLE
    A AEternal

    norm .net wrote:

    Whats good about VB, absolutely nothing, zilch.

    My first post on this board is in vehement agreement with this wise poster. :) Hello!

    The Weird and The Wonderful csharp css com help career

  • Good practice or not? Defaulting member variables via properties
    A AEternal

    I do understand it now. From a functional perspective, they're no different, but from a conceptual and practice perspective, it keeps the acts of Setting and Getting separate from one another. Thanks again, Scott. :)

    .NET (Core and Framework) question tutorial

  • Good practice or not? Defaulting member variables via properties
    A AEternal

    That makes sense, and I appreciate your taking the time to answer, Scott. :) This seems functionally equivalent to what I described, which is great, but I'm quite not certain what this method buys me. Predictability? What is your reasoning for doing this? I really want to understand.

    .NET (Core and Framework) question tutorial

  • Good practice or not? Defaulting member variables via properties
    A AEternal

    So in this example, what is use of preventing assignment of the member object to null? I'd still have to be prepared for null values to come back from the Name property, so if I'm prepared for that in my code, why would I then prevent the ability to set it to null? Though it seems like your example now tells the user that there was an attempt to write to the member object at some point because it is no longer null, whereas in mine, you never know if anyone tried to set it.

    .NET (Core and Framework) question tutorial

  • Good practice or not? Defaulting member variables via properties
    A AEternal

    I've been wrestling with the idea of defaulting member variables, not necessarily in the constructor, but in their accessor properties. For example:

    private string _name;
    
    public string Name
    {
        get
        {
            if (this._name == null) this._name = String.Empty;
            return this._name;
        }
        set { this._name = value; }
    }
    

    This way, I know that, no matter what, whenever I access MyObject.Name, I'll be getting a valid string object and never a null, so that when I go to do MyObject.Name.Trim(), I'll never get a null object exception. This saves me time and lines of code in my application. My question is, is this good practice? Is it better to let the exception occur and check for null elsewhere?

    .NET (Core and Framework) question tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups