Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C# UGH

Name: Anonymous 2007-08-27 11:12 ID:GSJsb+YC

public long lOffset         // Usable lump offset byte number.
{
    get
    {
        return (long)BitConverter.ToInt32(bOffset, 0);
    }
    set
    {
        bOffset = BitConverter.GetBytes(value);
    }
}
public long lSize           // Usable lump size number, in bytes.
{
    get
    {
        return (long)BitConverter.ToInt32(bSize, 0);
    }
    set
    {
        bSize = BitConverter.GetBytes(value);
    }
}
public string sName         // Usable string name.
{
    get
    {
        return (new ASCIIEncoding()).GetString(bName);
    }
    set
    {
        (new ASCIIEncoding()).GetBytes(value, 0, value.Length, bName, 0);
    }
}

WHY ARE GET...SET BLOCKS SO FUCKING BULKY?

Name: Anonymous 2007-08-27 12:20 ID:Jq+06lXz

when it's one line in the get or set, I usually just do it like this

public long lOffset         // Usable lump offset byte number.
{
    get { return (long)BitConverter.ToInt32(bOffset, 0) ; }
    set { bOffset = BitConverter.GetBytes(value); }
}
public long lSize           // Usable lump size number, in bytes.
{
    get { return (long)BitConverter.ToInt32(bSize, 0); }
    set { bSize = BitConverter.GetBytes(value); }
}
public string sName         // Usable string name.
{
    get { return (new ASCIIEncoding()).GetString(bName); }
    set { (new ASCIIEncoding()).GetBytes(value, 0, value.Length, bName, 0); }
}



Might be a bad practice, I dunno. But yeah, #region is superior.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List