public void Execute() { var numbers = new[] { 1, 2, 3, 4, 5, 0, 10, 98, 99 }; // // Min, Max拡張メソッドは、文字通り最小値、最大値を求める拡張メソッド。 // // Min, Max拡張メソッドには、各基本型のオーバーロードが用意されており // (decimal, double, int, long, single及びそれぞれのNullable型) // それぞれに、引数無しとselectorを指定するバージョンのメソッドがある。 // // // 引数無しのMin, Max拡張メソッドの使用. // Output.WriteLine("引数無し[Min] = {0}", numbers.Min()); Output.WriteLine("引数無し[Max] = {0}", numbers.Max()); // // selectorを指定するMin, Max拡張メソッドの使用. // Output.WriteLine("引数有り[Min] = {0}", numbers.Min(item => item%2 == 0 ? item : 0)); Output.WriteLine("引数有り[Max] = {0}", numbers.Max(item => item%2 == 0 ? item : 0)); }
public void GetHighwaysAroundATrace() { var coordinates = new[] { new Coordinate(35.0721059299491, 31.7345844629374), new Coordinate(35.0722749598696, 31.7344493612046), new Coordinate(35.0724650299992, 31.7343593734513), new Coordinate(35.0726656393144, 31.734278414797), new Coordinate(35.0728240900434, 31.7341613383465), new Coordinate(35.0730141845335, 31.7340533128296), new Coordinate(35.0732147545564, 31.733999408711), new Coordinate(35.0734153497475, 31.7339274673374), new Coordinate(35.0736159319493, 31.7338645441157), new Coordinate(35.0738269648752, 31.7338737791525), new Coordinate(35.0740065179928, 31.7337567228564), new Coordinate(35.0741860454097, 31.7336577032436), new Coordinate(35.0743760994771, 31.7335767310899), new Coordinate(35.0745872073466, 31.7335318540464), new Coordinate(35.0747877879099, 31.7334689289723), new Coordinate(35.0750094099336, 31.7334511173783), new Coordinate(35.0751780827882, 31.7335685289271), new Coordinate(35.075304484447, 31.7337309898203), new Coordinate(35.0754203592739, 31.733875402958), new Coordinate(35.075631492294, 31.7338124872473), new Coordinate(35.0757899385117, 31.7336954070893), new Coordinate(35.076000983732, 31.733695620056), new Coordinate(35.0761062700034, 31.7338670773442), new Coordinate(35.0762752679866, 31.733750007213), new Coordinate(35.0763282776713, 31.7335696908754), new Coordinate(35.0764335892192, 31.7337231109569), new Coordinate(35.0764755502133, 31.733903522773), new Coordinate(35.0765069466631, 31.7340929424433), new Coordinate(35.0764433971025, 31.7342642297681), new Coordinate(35.0766545179341, 31.734210330837), new Coordinate(35.0768129759193, 31.7340842309428), new Coordinate(35.0768659723906, 31.7339129328592), new Coordinate(35.0770349571566, 31.7338048801899), new Coordinate(35.077077425494, 31.7336155345132), new Coordinate(35.0771620779083, 31.7334442679391), new Coordinate(35.0773099940041, 31.7333091383914), new Coordinate(35.0774789771585, 31.733201085119), new Coordinate(35.0776900704132, 31.7331652213992), new Coordinate(35.0778906358404, 31.733111309903), new Coordinate(35.0780701578988, 31.7330122847953), new Coordinate(35.0782707350072, 31.732949354226), new Coordinate(35.0783975566018, 31.7328051840224), new Coordinate(35.0786085632373, 31.7328324480839), new Coordinate(35.0787349820835, 31.7329858871347), new Coordinate(35.0785870685653, 31.7331210183496), new Coordinate(35.0786184690549, 31.7333104375335), new Coordinate(35.078787158403, 31.7334188258485), new Coordinate(35.078998203021, 31.7334190338509), new Coordinate(35.0789979598472, 31.7335994032851), new Coordinate(35.0790293734868, 31.7337798038848), new Coordinate(35.0791452420196, 31.7339332321215), new Coordinate(35.0792188774317, 31.7341046557059), new Coordinate(35.0790920431788, 31.7342578451666), new Coordinate(35.0790073935652, 31.7344291130078), new Coordinate(35.0789227436393, 31.7346003807875), new Coordinate(35.0788170008094, 31.7347626092237), new Coordinate(35.0787007052087, 31.7349248271512), new Coordinate(35.0786055262394, 31.7350780473485), new Coordinate(35.0787319481167, 31.735231486356), new Coordinate(35.0786051115226, 31.735384675299), new Coordinate(35.0785415649283, 31.7355559636429), new Coordinate(35.0785413086455, 31.7357453514817), new Coordinate(35.0785410645645, 31.7359257208468), new Coordinate(35.0783720532398, 31.7360518124072), new Coordinate(35.0783401389555, 31.7362411688939), new Coordinate(35.0782765912839, 31.7364124570798), new Coordinate(35.0781286471515, 31.7365656246083), new Coordinate(35.0780334410476, 31.7367368812657), new Coordinate(35.078033195973, 31.7369172505991), new Coordinate(35.077916896304, 31.7370794677459), new Coordinate(35.0778111611683, 31.7372326768066), new Coordinate(35.0777159537945, 31.7374039332055), new Coordinate(35.0777157080984, 31.7375843025178), new Coordinate(35.0776415933391, 31.7377645983116), new Coordinate(35.0775042233589, 31.7378997386489), new Coordinate(35.0773984742927, 31.738061965808), new Coordinate(35.077356016867, 31.7382422929913), new Coordinate(35.0772713604142, 31.7384135595545), new Coordinate(35.0771761631707, 31.7385757970488), new Coordinate(35.0770282384852, 31.7387109263068), new Coordinate(35.0768276481157, 31.738773854829), new Coordinate(35.0767746363977, 31.7389541712216), new Coordinate(35.0767849293649, 31.739143569523), new Coordinate(35.0766580966081, 31.7392877379491), new Coordinate(35.0764785361171, 31.7394047978594), new Coordinate(35.0764255233596, 31.7395851140862), new Coordinate(35.0762565397989, 31.7396841473578), new Coordinate(35.0761191525296, 31.7398283046105), new Coordinate(35.0759290747261, 31.7399182977154), new Coordinate(35.0757389965557, 31.7400082905346), new Coordinate(35.07556998651, 31.7401253598077), new Coordinate(35.075422069537, 31.7402514686949), new Coordinate(35.075347960713, 31.7404227446012), new Coordinate(35.0752316644981, 31.740575940724), new Coordinate(35.0750626527834, 31.7406930093093), new Coordinate(35.0749674493503, 31.7408552450793), new Coordinate(35.0748195303999, 31.7409813532475), new Coordinate(35.0746821389885, 31.7411255089107), new Coordinate(35.0744920445507, 31.7412245183024), new Coordinate(35.0742809065562, 31.7412784135462), new Coordinate(35.0740698820776, 31.7412511423086), new Coordinate(35.0738692842443, 31.7413140661295), new Coordinate(35.0736897163418, 31.7414311220535), new Coordinate(35.0737110887846, 31.7412417560847), new Coordinate(35.0737213757529, 31.7414311545495), new Coordinate(35.0739746130962, 31.74145846961), new Coordinate(35.0742068200635, 31.7414316518359), new Coordinate(35.0739430042846, 31.7414223633422), new Coordinate(35.0738161133594, 31.7416026027021), new Coordinate(35.0737213757529, 31.7414311545495), new Coordinate(35.0736688636436, 31.7412507312107), new Coordinate(35.0736791505269, 31.7414401296783), new Coordinate(35.0734470322923, 31.741403817281), new Coordinate(35.0733629122239, 31.7411872874177), new Coordinate(35.0735738602188, 31.7412686705782), new Coordinate(35.07366858471, 31.7414491373023), new Coordinate(35.0736688382861, 31.7412687681284), new Coordinate(35.0736790617819, 31.7415032588881), new Coordinate(35.0736687748923, 31.7413138604224), new Coordinate(35.0736685086367, 31.7415032480535), new Coordinate(35.0736371028393, 31.7413228463722), new Coordinate(35.0736578920918, 31.7415483295102), new Coordinate(35.0736159331702, 31.7413679169887), new Coordinate(35.0736790110704, 31.741539332722), new Coordinate(35.0735948142246, 31.7413769137668), new Coordinate(35.0733730714032, 31.7414668704952), new Coordinate(35.0732040430139, 31.741592955047), new Coordinate(35.0730982822463, 31.7417551785124), new Coordinate(35.0729292402103, 31.7418902811492), new Coordinate(35.072897325567, 31.7420706176068), new Coordinate(35.0728970322257, 31.7422780421237), new Coordinate(35.0729494159191, 31.742548650317), new Coordinate(35.0728963945167, 31.7427289649634), new Coordinate(35.072875020064, 31.7429183307459), new Coordinate(35.0727903510918, 31.7430895941731), new Coordinate(35.0727584102237, 31.7432879674713), new Coordinate(35.0727686571624, 31.7435044213134), new Coordinate(35.0728634078656, 31.7436668516642), new Coordinate(35.0728420458834, 31.7438471989576), new Coordinate(35.0728523313512, 31.7440365974108), new Coordinate(35.0729048434282, 31.744217021007), new Coordinate(35.0729467894842, 31.7444064521357), new Coordinate(35.0729887229634, 31.7446049016993), new Coordinate(35.0730306821045, 31.7447853143363), new Coordinate(35.0731570951682, 31.7449477771037), new Coordinate(35.0731990675143, 31.7451191712236), new Coordinate(35.0732832543119, 31.745290608805), new Coordinate(35.0734201331591, 31.7455162113386), new Coordinate(35.073504320721, 31.7456876487653), new Coordinate(35.0735674013139, 31.7458590644448), new Coordinate(35.073514379198, 31.7460393792526), new Coordinate(35.0734718978551, 31.7462287233376), new Coordinate(35.0734399700405, 31.7464180782584), new Coordinate(35.0734185958184, 31.7466074440229), new Coordinate(35.0733760758875, 31.7468238434104), new Coordinate(35.0733125117918, 31.7469951287924), new Coordinate(35.0732383809504, 31.7471754217159), new Coordinate(35.0731747908997, 31.7473647439184), new Coordinate(35.0731323337189, 31.7475360509478), new Coordinate(35.0730687432034, 31.7477253730855), new Coordinate(35.0728576279114, 31.747752210526), new Coordinate(35.0727417526433, 31.7475987768878), new Coordinate(35.0725413065058, 31.7475444586732), new Coordinate(35.0723196504555, 31.7475622658438), new Coordinate(35.0720980328241, 31.7475530172805), new Coordinate(35.0720661145879, 31.7477333533597), new Coordinate(35.0718760167127, 31.7478233402533), new Coordinate(35.0717175414711, 31.7479404152068), new Coordinate(35.0715169276245, 31.7480033352151), new Coordinate(35.0712952702913, 31.748021140599), new Coordinate(35.0710842184905, 31.7480028828553), new Coordinate(35.0707991470583, 31.748083750191), new Coordinate(35.0705669225259, 31.7481105616797), new Coordinate(35.070355727634, 31.7481915056564), new Coordinate(35.0701445193519, 31.7482814677285), new Coordinate(35.0698806062971, 31.7483262814677), new Coordinate(35.069690518175, 31.7484072466362), new Coordinate(35.0694900982716, 31.7483348867345), new Coordinate(35.0693002456964, 31.7482535192697), new Coordinate(35.0690891937727, 31.7482352582222), new Coordinate(35.0689306749097, 31.7483793850317), new Coordinate(35.0688459936811, 31.7485506456573), new Coordinate(35.0687507713371, 31.7487128765305), new Coordinate(35.0686766171193, 31.7489021851694), new Coordinate(35.0684865004082, 31.7490011854202), new Coordinate(35.0683490873244, 31.749145334014), new Coordinate(35.0682222278403, 31.7492894937442), new Coordinate(35.0680637190623, 31.7494246009973), new Coordinate(35.0678841546853, 31.7495236116377), new Coordinate(35.0678205521274, 31.7497129310637), new Coordinate(35.0675989165801, 31.7497126931105), new Coordinate(35.0674720551597, 31.7498568520755), new Coordinate(35.0672822145624, 31.7497664631753), new Coordinate(35.0673563457203, 31.7495951922729), new Coordinate(35.0675567799378, 31.7496585370746), new Coordinate(35.0675570719935, 31.7494601312888), new Coordinate(35.0675362560014, 31.7492617028079), new Coordinate(35.0674837515326, 31.7490812771636), new Coordinate(35.0673357960589, 31.7492163948629), new Coordinate(35.0672727247051, 31.7490449762147), new Coordinate(35.0672202208685, 31.7488645504576), new Coordinate(35.0671677172341, 31.7486841246742), new Coordinate(35.0670202683561, 31.7484765410713), new Coordinate(35.0668621328059, 31.7483591303555), new Coordinate(35.0666512281231, 31.7482416623619), new Coordinate(35.0663873536906, 31.7482594135236), new Coordinate(35.0661761548512, 31.7483403505601), new Coordinate(35.0659649556455, 31.7484212872445), new Coordinate(35.0657853909871, 31.7485202949422), new Coordinate(35.0655636236203, 31.7486102379119), new Coordinate(35.0653312344155, 31.7487452611915), new Coordinate(35.0651621684056, 31.7488803533093), new Coordinate(35.0648981024323, 31.7490243596047), new Coordinate(35.0646764143359, 31.7490601903508), new Coordinate(35.0644653207964, 31.7490689769777), new Coordinate(35.0642226060128, 31.7490506730669), new Coordinate(35.0640010674143, 31.7489872997507), new Coordinate(35.0638006780009, 31.7488968940277), new Coordinate(35.0636214242285, 31.7487884744412), new Coordinate(35.0633892095983, 31.748806254391), new Coordinate(35.0632201680585, 31.7489233070343), new Coordinate(35.0630195463963, 31.7489862136328), new Coordinate(35.0629137320042, 31.74916646527), new Coordinate(35.0627447441787, 31.7492474434988), new Coordinate(35.0629453803109, 31.7491755188941), new Coordinate(35.0628817816826, 31.7493558173938), new Coordinate(35.0628503942158, 31.7491754133289), new Coordinate(35.062945119591, 31.7493468693199), new Coordinate(35.0630715074629, 31.7495183603865), new Coordinate(35.0629873494292, 31.749337897772), new Coordinate(35.062892610258, 31.7491754602555), new Coordinate(35.0629983972676, 31.749013245524), new Coordinate(35.0631990190023, 31.7489503389593), new Coordinate(35.0633996541446, 31.7488784136331), new Coordinate(35.0635686953778, 31.74876136075), new Coordinate(35.0637797610161, 31.7487706124952), new Coordinate(35.0639484473375, 31.7488880386621), new Coordinate(35.0641594996991, 31.7489063082235), new Coordinate(35.064338754328, 31.7490147270535), new Coordinate(35.0645497527902, 31.7490690697467), new Coordinate(35.0647609005064, 31.749024209202), new Coordinate(35.0649720480204, 31.7489793483065), new Coordinate(35.0651200065376, 31.7488442333555), new Coordinate(35.0652995860205, 31.7487362081591), new Coordinate(35.0654580976222, 31.7486011043378), new Coordinate(35.0656692842166, 31.7485291869437), new Coordinate(35.0658488490151, 31.7484301794102), new Coordinate(35.0660705485848, 31.7483853281693), new Coordinate(35.0662501126803, 31.748286320066), new Coordinate(35.0664612711907, 31.7482324382446), new Coordinate(35.066640834577, 31.7481334295863), new Coordinate(35.066841251814, 31.7482057939641), new Coordinate(35.0668937678874, 31.7483772014467), new Coordinate(35.0670836052757, 31.7484675909363), new Coordinate(35.0671044334497, 31.7486570010668), new Coordinate(35.067146382972, 31.7488374154995), new Coordinate(35.0671777653493, 31.7490268369847), new Coordinate(35.0673676309249, 31.7490991891557), new Coordinate(35.0675155861655, 31.7489640714163), new Coordinate(35.0675997659292, 31.7491355126294), new Coordinate(35.0676417166247, 31.7493159268888), new Coordinate(35.0675464913961, 31.7494781568345), new Coordinate(35.0673985486705, 31.749604256152), new Coordinate(35.0672611330113, 31.7497484035517), new Coordinate(35.0674721879958, 31.7497666676313), new Coordinate(35.0676622808173, 31.7496857058025), new Coordinate(35.0678313446779, 31.7495506103786), new Coordinate(35.0679792867333, 31.7494245105557), new Coordinate(35.0680639703565, 31.7492532505363), new Coordinate(35.0682435472287, 31.7491452211906), new Coordinate(35.0684441921122, 31.7490642694683), new Coordinate(35.0686026997237, 31.748929161731), new Coordinate(35.0687295581263, 31.7487850016109), new Coordinate(35.0688142529368, 31.7486047226235), new Coordinate(35.0687934081376, 31.7484243312081), new Coordinate(35.0689202786966, 31.7482711524368), new Coordinate(35.0691314093995, 31.7482353030807), new Coordinate(35.0693530414417, 31.7482355383587), new Coordinate(35.0695640280192, 31.7482988912063), new Coordinate(35.0697751063027, 31.7482991145731), new Coordinate(35.0699967515409, 31.7482903302844), new Coordinate(35.0701868521787, 31.7482003462086), new Coordinate(35.0703979952399, 31.7481554763039), new Coordinate(35.0705986361243, 31.7480745211655), new Coordinate(35.0708097657446, 31.7480386690246), new Coordinate(35.0710209210809, 31.7479847796365), new Coordinate(35.0712320374191, 31.7479579452428), new Coordinate(35.0714116081244, 31.7478499113934), new Coordinate(35.0715912041799, 31.7477238403902), new Coordinate(35.0718022425878, 31.7477511157425), new Coordinate(35.0719818250794, 31.747634062634), new Coordinate(35.0721613942917, 31.7475260277185), new Coordinate(35.072362032293, 31.7474450697877), new Coordinate(35.0725731470276, 31.7474182331655), new Coordinate(35.0727207216137, 31.7475446443615), new Coordinate(35.0728365840174, 31.7477070964692), new Coordinate(35.0730476737287, 31.7476982959621), new Coordinate(35.0732588270095, 31.7476444028572), new Coordinate(35.0730371835969, 31.7476531928257), new Coordinate(35.0732481841093, 31.747707521133), new Coordinate(35.0732479296541, 31.7478878901212), new Coordinate(35.0734483515404, 31.747960244123), new Coordinate(35.0736699829664, 31.7479604718909), new Coordinate(35.0738810225329, 31.7479877438026), new Coordinate(35.0741026413882, 31.7479969892676), new Coordinate(35.0743242476704, 31.7480152527968), new Coordinate(35.0744929585881, 31.7481236466026), new Coordinate(35.074534922209, 31.7483040586565), new Coordinate(35.0747247669137, 31.7483944367834), new Coordinate(35.0749358956958, 31.7483585778055), new Coordinate(35.0751575782355, 31.7483227291915), new Coordinate(35.0753687066906, 31.7482868694952), new Coordinate(35.0755797724991, 31.7482961016964), new Coordinate(35.0757909007336, 31.7482602412999), new Coordinate(35.0760125578048, 31.7482424280959), new Coordinate(35.0762342147926, 31.7482246145061), new Coordinate(35.0764452433117, 31.7482609006234), new Coordinate(35.0766562843894, 31.7482881679415), new Coordinate(35.076867276103, 31.7483515087101), new Coordinate(35.0770782681049, 31.7484148491295), new Coordinate(35.0772152594454, 31.7485682999149), new Coordinate(35.0773945410268, 31.7486676819746), new Coordinate(35.0775315332608, 31.7488211324163), new Coordinate(35.0777213696559, 31.7489205245313), new Coordinate(35.0779112309998, 31.7490018794643), new Coordinate(35.0781116344313, 31.7490922630334), new Coordinate(35.0782803517274, 31.7492006518231), new Coordinate(35.0784279369092, 31.749327056402), new Coordinate(35.0785966305898, 31.7494534816689), new Coordinate(35.0787547584758, 31.7495889147441), new Coordinate(35.0789128868221, 31.7497243476215), new Coordinate(35.0790499074385, 31.7498597595188), new Coordinate(35.0791552296681, 31.7500221954664), new Coordinate(35.079271118537, 31.7501756232497), new Coordinate(35.0793342006427, 31.7503560544372), new Coordinate(35.0794184034622, 31.7505274878662), new Coordinate(35.07948148609, 31.7507079189722), new Coordinate(35.0795762437083, 31.7508793626449), new Coordinate(35.0796815559056, 31.7510508165839), new Coordinate(35.0797657720828, 31.751213231321), new Coordinate(35.0798288558452, 31.7513936622385), new Coordinate(35.0799236147985, 31.7515651056378), new Coordinate(35.0800078197918, 31.7517365386504), new Coordinate(35.0800920130332, 31.7519169900494), new Coordinate(35.0801550979012, 31.7520974207882), new Coordinate(35.0802287373828, 31.7522778617867), new Coordinate(35.080344618785, 31.7524403069963), new Coordinate(35.0804921998805, 31.7525757275856), new Coordinate(35.0805658524078, 31.7527471499334), new Coordinate(35.0807239767497, 31.7528915989612), new Coordinate(35.0808398717683, 31.7530450252643), new Coordinate(35.0809768761181, 31.7531984719274), new Coordinate(35.0811033144633, 31.7533609266626), new Coordinate(35.0812191987379, 31.7535233710565), new Coordinate(35.0813562282957, 31.7536587804158), new Coordinate(35.0814509923604, 31.7538302226312), new Coordinate(35.0815668897444, 31.7539836482564), new Coordinate(35.0816616545267, 31.7541550903082), new Coordinate(35.0817564196575, 31.7543265322858), new Coordinate(35.0819357171872, 31.7544259079069), new Coordinate(35.0820516042382, 31.7545883515235), new Coordinate(35.0821675035548, 31.7547417765889), new Coordinate(35.0822411608737, 31.7549131979221), new Coordinate(35.0823676155936, 31.755066632928), new Coordinate(35.0824835160256, 31.7552200576973), new Coordinate(35.0825677172042, 31.7554005073817), new Coordinate(35.0826519423383, 31.7555629201228), new Coordinate(35.0827784104194, 31.7557073362678), new Coordinate(35.0828837457549, 31.7558697690173), new Coordinate(35.0829679600791, 31.7560411999812), new Coordinate(35.0830838509386, 31.7562036426272), new Coordinate(35.0832420085743, 31.7563300515947), new Coordinate(35.083442491669, 31.7563753345247), new Coordinate(35.0836641197941, 31.7563935818417), new Coordinate(35.0838857129203, 31.756438884096), new Coordinate(35.0840967630902, 31.7564751575489), new Coordinate(35.0843183566239, 31.7565204590512), new Coordinate(35.0845188639271, 31.7565477034066), new Coordinate(35.0847298913663, 31.7566020126932), new Coordinate(35.0849091964647, 31.7567013841131), new Coordinate(35.0850779123208, 31.7568278007081), new Coordinate(35.0852889291647, 31.7568911275094), new Coordinate(35.0854365360624, 31.7570175238719), new Coordinate(35.0856052647388, 31.757134921325), new Coordinate(35.0857845602899, 31.7572433099498), new Coordinate(35.0859532783201, 31.7573697253802), new Coordinate(35.0860903319162, 31.7574961111571), new Coordinate(35.0862590508207, 31.7576225261797), new Coordinate(35.0863960937519, 31.7577579300644), new Coordinate(35.0865754028623, 31.7578572991312), new Coordinate(35.0867547123563, 31.7579566679449), new Coordinate(35.0869551550878, 31.7580380191071), new Coordinate(35.0871555981708, 31.7581193699537), new Coordinate(35.0873243423818, 31.7582277466806), new Coordinate(35.0875247748542, 31.7583181153851), new Coordinate(35.0876935085294, 31.7584355100609), new Coordinate(35.0878833867277, 31.7585258685215), new Coordinate(35.0880838655461, 31.7585801625885), new Coordinate(35.0882843107889, 31.7586615116576), new Coordinate(35.0885059565864, 31.758670732122), new Coordinate(35.0887065820637, 31.7586077854993), new Coordinate(35.0888966746076, 31.7585267921022), new Coordinate(35.0890762453278, 31.7584187335373), new Coordinate(35.089276869878, 31.7583557860119), new Coordinate(35.0894880269069, 31.7583108845794) }; var highways = _gateway.GetHighways(new LatLng { lat = coordinates.Max(c => c.Y), lng = coordinates.Max(c => c.X) }, new LatLng { lat = coordinates.Min(c => c.Y), lng = coordinates.Min(c => c.X) } ).Result; highways = _gateway.GetHighwaysAroundATrace(coordinates).Result; Assert.AreEqual(66, highways.Count); }