Quick brainteaser

Just a really quick one today…

What’s the point of this code? Does it have any point at all?

public static class Extensions
{
    public static void Add<T>(this ICollection<T> source, T item)
    {
        source.Add(item);
    }
}

Bonus marks if you can work out what made me think about it.

I suggest you ROT-13 answers to avoid spoilers for other readers.

34 thoughts on “Quick brainteaser”

  1. Guvf nqqf n trarevp Nqq rkgrafvba zrgubq gb trarevp pbyyrpgvbaf. Fb jura nqqvat na vgrz, vgf glcr vf rkcyvpvgyl zragvbarq. Ab vqrn jul gubhtu… :| Ernqnovyvgl? :)

    Like

  2. Zl thrff vf gung lbh’er hfvat guvf gb trg nebhaq pnfgvat qhr gb na rkcyvpvg vagresnpr vzcyrzragngvba.

    Vs fb, creuncf lbh’er hfvat PbapheeragQvpgvbanel naq ner naablrq gung Erzbir() vf rkcyvpvgyl vzcyrzragrq naq qba’g jnag gb hfr GelErzbir(), orpnhfr lbh qba’g pner nobhg gur bhg cnenzrgref :)

    Like

  3. Qhaab, znlor gur pynff lbh jnag gb nqq gb rkcyvpvgyl vzcyrzragf gur vagresnpr VPbyyrpgvba. Fb guvf zvtug or gb fnir n pnfg?

    Like

  4. Vg yrgf lbh pnyy Nqq ba na vafgnapr bs n glcr juvpu rkcyvpvgyl vzcyrzragf VPbyyrpgvba jvgubhg arrqvat gb hfr n ohapu bs cneragurfrf gb pnfg vg.

    Also, your captcha is not working in Chrome Version 33.0.1750.154 m.

    Like

  5. Rirel glcr vzcyrzragvat VPbyyrpgvba zhfg unir na Nqq zrgubq. Va guvf jnl gur qrsnhyg vzcyrzragngvba nyjnlf uvqrf lbhe rkgrafvba zrgubq.

    Like

  6. Vs unf fbzrguvat gb qb jvgu gur arj PFunec FVK srngher: Nqq rkgrafvba zrgubqf sbe pbyyrpgvba vavgvnyvmref. Ohg hasbeghangryl V qba’g xabj jung’f gur cbvag fvapr jr pna hfr pbyyrpgvba vavgvnyvref jvgu VPbyyrpgvba vzcyrzragngvbaf (rt Yvfg)

    Like

  7. Vg’yy nyybj lbh gb pbzcvyr n pnyy gb Nqq ba n ErnqBaylPbyyrpgvba (juvpu unf na rkcyvpvg vzcyrzragngvba bs VPbyyrpgvba.Nqq), fb gung lbh’yy vafgrnq trg n AbgFhccbegrqRkprcgvba ng ehagvzr. Zber trarenyyl, vg’f hauvqvat gur rkcyvpvg vagresnpr vzcyrzragngvba; znlor gung’f npghnyyl hfrshy ba nabgure glcr. Vg whfg frrzf yvxr n tbbq jnl gb trg crbcyr gb jevgr ohtf jura ivrjrq sebz gur crefcrpgvir bs n ErnqBaylPbyyrpgvba, gubhtu.

    Like

  8. Vg frrzf gb zr yvxr guvf pbqr vf vagraqrq gb cebivqr n phfgbz vzcyrzragngvba bs Nqq gb na VPbyyrpgvba. Ubjrire, fvapr VPbyyrpgvba nyernql unf na Nqq (aba trarevp) zrgubq, gur glcr vasrerapr qbrfa’g jbex. Gur erfhyg vf gung rirel gvzr guvf Nqq zrgubq vf tbvat gb or pnyyrq, gur glcr zhfg or cebivqrq be ryfr gur aba trarevp qrsnhyg zrgubq vf pnyyrq. Sbe rknzcyr

    VPbyyrpgvba crbcyr = arj Yvfg();
    crbcyr.Nqq(arj Crefba());//pnyy Nqq
    crbcyr.Nqq(arj Crefba());//pnyy Nqq, ybfg glcr vasrerapr

    Vg jbhyq frrz gur erprag npgvivgl sebz p# 6 fcnjarq guvf, naq lbhe cerivbhf pbzzragf nobhg rkgrafvba zrgubqf vf cebonoyl jul lbh ner erivfvgvat gurfr.

    Like

  9. Fb lbh pna pnyy na rkcyvpvgyl vzcyrzragrq zrzore ivn vagresnpr. Sbe rknzcyr, vg jbhyq yrg zr qb fbzrguvat yvxr guvf:

    YvaxrqYvfg yvaxrqYvfg = arj YvaxrqYvfg();
    yvaxrqYvfg.Nqq(11);

    Gur rknzcyr vf abg irel hfrshy, ohg V pna frr vg orvat unaql fbzrgvzrf.

    Like

  10. V ernyyl ubcr guvf vfa’g gur nafjre… ohg jung lbh’ir perngrq gurer vf n cnggrea juvpu znxrf guvf pynff ‘hfnoyr’:

    choyvp pynff ZhygvPbyyrpgvba
    : VPbyyrpgvba, VPbyyrpgvba
    jurer F : pynff
    jurer G : fgehpg
    {
    … gjb rkcyvpvg vagresnpr vzcyrzragngvbaf tb urer
    }

    Like

  11. Jvgu guvf rkgrafvba, lbh jvyy or noyr gb jevgr pbqr yvxr “pbyyrpgvba.Nqq(vgrz)” rira vs pbyyrpgvba vzcyrzragf VPbyyrpgvba rkcyvpvgyl, r.t. vgf npghny glcr vf Neenl.

    Like

  12. Vs n pynff vzcyrzragf VPbyyrpgvba<G> ohg vzcyrzragf gur Nqq-zrgubq rkcyvpvgryl (ibvq VPbyyrpgvba<G>.Nqq(G vgrz)), lbh pnaabg pnyy gur Nqq-zrgubq qverpgyl ba na vafgnapr bs gung pynff. Lbh pna rvgure pnfg vg gb VPbyyrpgvba<G> svefg, be hfr guvf rkgrafvba zrgubq.

    Like

  13. Dhvpx dhrfgvba, Vs V vzcyrzragrq na rkgrafvba zrgubq jvgu gur fnzr anzr bs na rkvfgvat bar; juvpu bar bs gurz gur PYE jvyy eha?

    Like

  14. Vf vg gb fubj lbh pna pnyy gur Nqq rkgrafvba zrgubq sebz n pbyyrpgvba vavgvnyvmre (P#6 srngher)?
    Cerivbhfyl, IO pbhyq pnyy na Nqq rkgrafvba zrgubq ohg P# pbhyqa’g jura vavgvnyvfvat n pbyyrpgvba. Gur pbqr nf vg fgnaqf qbrfa’g qb zhpu gubhtu…

    Like

  15. Nppbeqvat gb Zvpebfbsg qbphzragngvba, rkgrafvba zrgubqf nera’g pnyyrq vs gurve fvtangher whfg zngpurf gur bar va gur fcrpvsvp glcr:

    uggc://zfqa.zvpebfbsg.pbz/ra-hf/yvoenel/oo383977.nfck

    Ubjrire, vg frrzf n pnfr yvxr guvf jbhyq tb guebhtu gur rkgrafvba zrgubq vafgrnq bs gur rkcyvpvgyl vzcyrzragrq vagresnpr zrgubq:

    choyvp pynff ZlPbyyrpgvba : VPbyyrpgvba
    {
    ibvq VPbyyrpgvba.Nqq(G vgrz)
    {
    // …
    }

    // …
    }

    Gur “gevpx” bayl jbexf jura gur bowrpg vf bs ZlPbyyrpgvba “funcr” vafgrnq bs VPbyyrpgvba. Gung vf, guvf jbhyq tb guebhtu gur rkgrafvba zrgubq:

    ZlPbyyrpgvba pbyyrpgvba = arj ZlPbyyrpgvba();
    pbyyrpgvba.Nqq(“N”);

    Ohg guvf jvyy tb guebhtu ZlPbyyrpgvba.Nqq zrgubq

    VPbyyrpgvba pbyyrpgvba = arj ZlPbyyrpgvba();
    pbyyrpgvba.Nqq(“N”);

    Znlor Zvpebfbsg’f fgngrzrag fubhyq fgngr gung gur bayl zrgubqf gb gnxr vagb nppbhag sbe qvfnzovthngvba ner gubfr npprffvoyr sbe gur pheerag “funcr” bs gur bowrpg. Gung vf, gur vagresnpr gur bowrpg vf rkcbfvat guebhtu gur glcr bs inevnoyr vg vf fgberq gb.

    Like

  16. Sebz uggc://zfqa.zvpebfbsg.pbz/ra-hf//yvoenel/oo383977.nfck:
    Vs lbh qb vzcyrzrag rkgrafvba zrgubqf sbe n tvira glcr, erzrzore gur sbyybjvat cbvagf:
    1)Na rkgrafvba zrgubq jvyy arire or pnyyrq vs vg unf gur fnzr fvtangher nf n zrgubq qrsvarq va gur glcr.
    2)Rkgrafvba zrgubqf ner oebhtug vagb fpbcr ng gur anzrfcnpr yriry. Sbe rknzcyr, vs lbh unir zhygvcyr fgngvp pynffrf gung pbagnva rkgrafvba zrgubqf va n fvatyr anzrfcnpr anzrq Rkgrafvbaf, gurl jvyy nyy or oebhtug vagb fpbcr ol gur hfvat Rkgrafvbaf; qverpgvir.

    2 vf ab ybatre gehr va P# 6. V fhfcrpg fbzrguvat qvssrerag jvyy unccra va P# 6 guna va cerivbhf irefvbaf, ohg guvf fgvyy ybbxf yvxr vg fubhyq arire or pnyyrq gb zr.

    Like

  17. @Bryan: They’re rot13-encoded to prevent spoilers, basically. Copy and paste one into rot13.com and you’ll see the plaintext.

    Like

  18. Vg nyybjf lbh gb nibvq gur rkcyvpvg pnfg gb VPbyyrpgvba va beqre gb pnyy Nqq ba na vafgnapr gung rkcyvpvgyl vzcyrzragf gur vagresnpr zrgubq. Lbh gubhtug nobhg vg orpnhfr lbh jrer jbaqrevat jul gur Nqq zrgubq jnf nccrnevat nf na rkgrafvba zrgubq va VagryyvFrafr sbe na bowrpg bs glcr ErnqBaylPbyyrpgvba?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s