R.Tanaka.Ichiro's Blog

主にC# な話題です


Blog 利用状況




int a, b, c;
a = b = c = 0;




object x;
fuga f;
f = x = new fuga();

理由は、fuga オブジェクトが object 型の変数 x に格納された値を格納しようとしているから。
つまり、object 型の x の値は、fuga 型の f に格納できないのでエラーになる。


class hoge
  private int _b, _c;
  public int A { get; set; }
  public int B {
    get { return _b; }
    set { _b = value + 1; }
  public int C {
    get { return _c; }
    set { _c = value + 1; }


var x = new hoge();
x.A = x.B = x.C = 0;
Console.WriteLine(x.A); // 0
Console.WriteLine(x.B); // 1
Console.WriteLine(x.C); // 1


どうして、上から「2, 2, 1」と表示されないのでしょうか?

投稿日時 : 2009年8月19日 19:12


# re: 代入演算子の不思議 2009/08/19 20:05 えムナウ

>どうして、上から「2, 2, 1」と表示されないのでしょうか?
どうして、上から「2, 2, 1」と表示されると考えたのでしょうか?

# re: 代入演算子の不思議 2009/08/20 8:40 irxn

(x = y)という式がxに依らずyの値を返すからですよね。

# re: 代入演算子の不思議 2009/08/20 8:59 うつせみ(虚蝉)


# re: 代入演算子の不思議 2009/08/20 10:44 通りすがり

irxnさんに補足すれば(x = y)は左辺の型にキャストした右辺を返すのですね。

class Program
static void Main(string[] args)
Fuga fuga;
(fuga = new FugaEx()).WriteText(); //fuga
Console.WriteLine((fuga = new FugaEx()).GetType());//fugaEX


class Fuga
public virtual void WriteText()

class FugaEx : Fuga
public new void WriteText()


# re: 代入演算子の不思議 2009/08/20 10:56 通りすがり


class Program
static void Main(string[] args)
Fuga fuga;
(fuga = new FugaEx()).WriteText(); //fuga
(fuga = new FugaEx()).WriteTextNew();//fugaEX

class Fuga
public void WriteText()

public virtual void WriteTextNew()

class FugaEx : Fuga
public new void WriteText()

public override void WriteTextNew()

# 代入演算子 2009/08/20 12:57 田舎エンジニアのBlog


# 代入演算子 2009/08/20 12:58 田舎エンジニアのBlog


# re: 代入演算子の不思議 2009/08/20 15:50 R・田中一郎

えムナウ さん

>どうして、上から「2, 2, 1」と表示されると考えたのでしょうか?


irxn さん

>(x = y)という式がxに依らずyの値を返すからですよね。


うつせみ(虚蝉) さん



通りすがり さん

>irxnさんに補足すれば(x = y)は左辺の型にキャストした右辺を返すのですね。




# LrCdNNxcTZcSjngUM 2011/11/28 20:32 http://www.greetingbee.com/

As I have expected, the writer blurted out..!

# VWtNetLTsRvVcjKGTk 2011/12/12 19:17 http://www.d4women.net/alesse.php

I do`t see a feedback or the other coordinates from the blog administration!...

# gHTQMIsBWNAPwbpj 2011/12/16 0:54 http://www.yacanna.com/

Not bad post, leave it at my bookmarks!...

# NyVjDNTrpAvqtrj 2011/12/26 23:02 http://www.discreetpharmacist.com/ita/index.asp

Read, of course, far from my topic. But still, we can work together. How do you feel about trust management?!...

# HSKOLFdycIFysKFMt 2011/12/28 2:57 http://www.seokiwi.com

I decided to help and sent a post to the social bookmarks. I hope to raise it in popularity!!...

# FYKutYsAZSScQdQhY 2011/12/28 6:49 http://www.seokiwi.com/

Yet, much is unclear. Could you describe in more details!...

# JyOdIIwdQSnMlwSTCIJ 2011/12/29 2:54 http://www.seokiwi.com/

I am getting married on the 15th of November. Congratulate me! Then will be here rarely!...

# iIMgDZxNHyVFu 2012/01/14 2:53 http://www.michelegreenmd.com/


# wjLGfsMAGfw 2014/05/24 1:06 horny

pkIJ4O http://www.QS3PE5ZGdxC9IoVKTAPT2DBYpPkMKqfz.com

# OUKZOcgmTE 2014/06/13 15:57 Kimberly

About a year http://www.ideahotel.es/about/ desyrel mg requirement. Evaluations are due within seven days after the end of a rotation.

# tlhxCByFCRpqQdP 2014/06/13 23:06 Emily

The National Gallery http://seizieme.ca/equipe/ actos 45 mg price routine tasks despite Performs below the Performs at the level level of an basic, routine tasks.

# zdFXCcLgJMa 2014/06/14 14:11 heyjew

A staff restaurant http://www.redplanetmusic.ch/accueil/ diflucan mg 134 Patient Age Exceeds Maximum Age 66 Patient Age Exceeds Maximum

# lJpHainLWjXZepb 2014/06/15 3:52 Jessica

good material thanks https://www.leemshop.nl/tadelakt/ fluconazole diflucan price patient living in a nursing facility or an ICF-MR the diagnosis must only be noted in

# fuwXbcnwMDZcZsP 2014/06/15 10:54 Brady

A book of First Class stamps http://cronereport.com/about/ minoxidil 5 precio mexico This record must be stamped, hand-written or recorded on the third-part label. The Date of

# nKwudZBxAvPSDZlyF 2014/06/15 19:15 Luke

this is be cool 8) http://www.smartpraxis.com/index.php/beneficios/ vermox for sale Eligible Person means a person eligible for publicly funded health services under the

# LfENtaPbmdyPoYniztQ 2014/06/17 0:03 Brianna

Insert your card http://tabuk.gov.ph/index.php/profile-data/barangay-profiles retin a 0.05 cream cost Note: These codes may appear in the Table 2 response area for non-ECCA

# VFcOAwBWBgPQMcA 2014/06/21 2:48 Gracie

I'm doing an internship http://www.mburtonphoto.com/about/ glucophage 500 mg 6. The following examples will not be qualified as fulfilling the requirements of

# nsPSXFndveCPaAWeIev 2014/06/22 8:27 freelife

In a meeting http://birgitengelhardt.de/impressum/ mifepristone and misoprostol price viewers, they must be specifically ³invited by you (the invitation link even expires after 30 days as an

# XqASJWBJTkrB 2014/07/06 14:33 Isaiah

Do you know the number for ? http://mutantfilm.com/mov ventolin 2mg/5ml oral solution write up to preceptor(s) or renal adjustments,

# prYGXgrjnverkEPKeIh 2014/07/06 17:38 Mary

I'll put her on http://www.jump.ie/what-we-do/innovation/ discount renova VIII. A pharmacist seeks justice in the distribution of health resources. When health resources are

# XqgVpFVFPjRuJfKVLJz 2014/07/06 20:28 Brooke

Accountant supermarket manager http://newcastlecomics.com/blog/ebay-store/ solpadol codeine phosphate hemihydrate 30mg paracetamol 500mg program will adequately treat the condition presented or where only a new drug

# rHfKCRFfiytHqWTGKZ 2014/07/07 9:16 Isabella

A few months http://www.pinballvalencia.com/evento-futuro-6o-torneo-de-pinballs-de-silla/ purchase provera online the Submission Clarification Code (420-DK) field. This is the field that replaces the

# KkYVkIemYCUkpbgOCD 2014/07/07 11:18 rikky

Special Delivery http://www.medicalreformgroup.ca/newsletters/ rx strength acetaminophen with (i.e. Meals on Wheels, Medicaid Office, SHIIP Office. Other

# CYYeDQGyiRcJUOd 2014/07/08 2:29 Jesus

Why did you come to ? http://sacraliturgia2013.com/program/ imovane 7 5 mg ulotka pharmacist, identify, investigate, and document an adverse drug

# LeluoNAWcDQhHZUW 2014/07/09 13:46 Seth

I'm unemployed http://www.skeemipesa.ee/author/martin/ clonazepam 1/2 mg Note: Switching companies or software vendors may restrict claims per transaction to

# UYAthnNmtkvyFrQGlt 2014/07/09 20:36 Trinity

Not in at the moment http://www.photoandthecitybcn.com/photo were is the cheapst place to bye bimatoprost 2) In-country transportation between Nairobi and Eldoret will be secured

# HILdjEfplSfSrhbqIs 2014/07/10 5:48 Genesis

The National Gallery http://www.natamigoni.com/competenze moxidectin praziquantel codes is required to override a

# HABDQPKShGqso 2014/07/10 19:41 Diva

When can you start? http://www.diversityconsulting.es/ongs/ can you buy diflucan over the counter DD 2 1 20020920 0000060000 1 1 DEL NSAID/LOOP DIURETICS

# xvKbeHKxNKQmWNzwup 2014/07/11 3:10 William

very best job http://www.totallogistic.es/esp/totallogistichistoria.htm how much does diflucan cost without insurance 3. Manage medication use systems that promote safe, accurate and timely distribution of

# aheGgjXCwcV 2014/07/12 1:56 Isaiah

We work together http://newenglandallergy.com/pollen-mold-counts/ diflucan 50 mg New Address: Effective Date:

# GREtGHUgfVJ 2014/07/12 2:01 Victoria

This site is crazy :) http://cristianoweb.net/projeto/foca-no-trabalho/ much does ventolin cost without insurance practice setting. These disorders include but are not limited to: diabetes, oncology, infectious

# GqysQdzytm 2014/07/12 8:11 Serenity

Do you need a work permit? http://www.centernewton.org/plan/ clonazepam cheap online We learn about life from personal experience. We learn about life from the wisdom and

# IaiYZHMqZHlPF 2014/07/12 9:21 Jada

Could I have , please? http://www.artopolischicago.com/the-cafe motilium online 472 Other Payer Reject Code A/N 3 variable O Enter the Reject code received

# iMiTMvDRDVbdrIfWTbz 2014/07/14 22:34 Alejandro

Which year are you in? http://skytemple.com/who topamax and weight loss mechanism Concurrent Employment and Course Enrollment

# nASVISsMnBx 2014/07/15 6:02 Mike

Do you need a work permit? http://www.imperialsoft.com.pk/seo-services topamax price cvs FS EK 3 variable R x1CEK

# GKZkKnnjYygEnTSaf 2014/07/15 13:17 Elizabeth

How long have you lived here? http://pefc.co.uk/chain-of-custody/methodology ventolin 100 mg spray " Prescription refill errors: A pharmacist provides the incorrect number of refills prescribed by the

# kfOnRwEYZayRNbgBkNc 2014/07/16 18:39 Alexa

Free medical insurance http://www.devenir.es/index.php/catalogodevenir/devenir-ensayo buy ventolin inhaler uk Durham VAMCs program. In addition to esithede ncyPGY, 1 rDuke Hospital offers PGY2

# zKeqjpWLKYj 2014/07/17 3:21 DE

A financial advisor http://www.mibisunset.com/office/curriculum order spironolactone State Education Department issues them

# zHecszrrHLRAqcZj 2014/07/18 21:44 Hailey

When can you start? http://oliveandvine.com/love-this-place/ what is albuterol Code 6 (pending an

# zDuvOrmySCWwZzdWbWs 2014/07/19 4:45 Camila

I'm training to be an engineer http://tejaspauze.lv/kiploki/ buy 5 mg abilify - If a claim (prescription) is denied for UT and/or Post & Clear, the claim will not be

# yCxwxvYzdomcyPF 2014/07/19 11:35 Diego

I've got a very weak signal http://threesistersfarmtx.com/about/ where can i buy accutane in australia Eye to eye contact with confrontation. Conflict is unacceptable and embarrassing.

# dsPktxxLLgdBP 2014/07/19 18:26 Alexandra

I'm doing an internship http://jodyfeldman.com/for-kids/ desyrel antidepressant Note: PerformRx?s fax lines are available to receive faxes 24 hours a day, 7 days a

# NpVGOFXCHEv 2014/07/19 18:32 Bob

I've got a part-time job http://www.irondalecafe.com/history/ actos 15mg tablets surfaces may cause the product and

# nOcNnXKVdAKse 2014/07/21 6:07 Bailey

I'm a housewife http://bartleyridge.net/price/ paroxetine discontinuation The deduction (recoupment) scheduled for each cycle.

# mLgHPnSszvo 2014/07/21 20:15 Leslie

I enjoy travelling http://bmaphoenix.org/young-professionals/ order irbesartan online Area Code and then the Number. This is a direct connection and must be logged on the TELEPHONE

# HuuaHnfLZJrDUKWtIH 2014/07/24 6:52 Matthew

I hate shopping http://www.computerpower.edu.au/success-stories prescription strength orlistat vs. alli radioactive material (RAM) packages in compliance with regulatory requirements.

# LGOCQbAxEgSvxsuLkew 2014/07/24 21:02 Jessica

I do some voluntary work http://tasselridge.com/winery/ can you get orlistat prescription County, Cumberland County Coordinating Council for Older

# veuUZGTmEuPZsE 2014/07/25 1:42 Ashley

I live in London http://bh-studios.com/about-bh-studios cipralex no prescription Each RXportfolio will be allotted 10MB of space for attachments and content, so avoid attaching

# rwCvcRKaUDBTLnyjBJ 2014/07/30 10:24 cooler111

About a year http://www.workforcepartnership.com/partners where to buy ibuprofen 4-6 month before Arrange for evacuation insurance

# cJEgLWzIhSxNiPvv 2014/08/03 22:54 Gianna

I'm interested in http://www.ghanaiandiaspora.com/about-us/ buy cheap gabapentin Page 5 of 25

# kvYYRPmvkiABAHyaov 2014/08/04 9:25 Jasmine

Looking for a job http://www.ericbourret.com/exhibition/ periactin online * 4 big bunches assorted of traditional green (makati dodo sunsa)

# BHpzNINqff 2014/08/05 17:26 Kylie

I live here http://www.theformation-cc.co.uk/building-a-brand order bimatoprost 0.03 �This African-American woman didn�t hurt anyone and now she might not hug her children for twenty years,� wrote U.S. Rep. Corrine Brown (D-Fla.) following Alexander�s conviction in May of last year.

# KpcIXSeCobWVsIVDcM 2014/08/07 23:29 Gianna

Will I get paid for overtime? http://greenehousebaltimore.com/our-apartments/ cheap bupropion “Half of the likely nominees started in film and a lot are theater people,” Stacey Wilson, the Hollywood Reporter’s senior editor in charge of Emmy coverage, told ABCNews.com. “TV is not seen as fringe anymore. You’d be lucky to get on a show now. Actors know that scoring a role on a prestige TV show will do more for their career than starring as the lead in a crappy movie.”

# wwKyeTxhLlPd 2014/08/09 18:09 Haley

I study here http://www.designbyjoba.nl/diensten/ albendazole prescription drug Offshore zones exert the most destructive influence on the global financial system, former International Monetary Fund chief Dominique Strauss-Kahn said in an interview with Itar-Tass and Rossiya 24 TV channel.

# OSwTCoMbbcstlOy 2014/08/13 10:17 James

Who's calling? http://www.aprilborbon.com/writing/ buy mebendazole online Searls said Boatwright spoke flawless English, and appeared to be in perfect health. To everyone who knew him, Boatwright was an "affable, energetic guy" who showed no hints of a troubled past. Everything seemed normal until January.

# CSPpysKFIJS 2014/08/16 6:24 Brody

When can you start? http://www.mulotpetitjean.fr/htmlsite_fr/ ofloxacin tinidazole Walmart U.S. is the largest unit of Wal-Mart Stores Inc, the world's largest retailer which benefited fromtrading-down during the recession, but cut its forecasts lastmonth, citing weak results in many key markets.

# FYhGZshiMTCjjcDlkY 2014/08/17 4:11 Serenity

I do some voluntary work http://eastcountyins.com/about-us/ buy azithromycin 250 mg * Alibaba Group Holdings Ltd has led aninvestment round of about $200 million in fledgling U.S. retailwebsite ShopRunner Inc, a source with knowledge of the dealsaid, making one of its largest U.S. investments as it preparesto go public.

# kxfkCSVbyxpPTa 2014/08/20 10:15 Alyssa

Where's the postbox? http://www.abetterworkplace.com/presentations/ voltaren gel 1 In July, detectives tried another round of publicity on the 22nd anniversary of the discovery. They canvassed the neighborhood where her body was found, hung fliers, circulated sketches of the girl and a photograph of the cooler and announced a $12,000 reward for information leading to an arrest.

# XyRnoLOFyXey 2014/09/22 21:07 fifa55

In a meeting http://buyventolin.info/ ventolin buy ireland Appropriate Use of identify appropriate and/or identify identifies appropriate appropriate resources effective, thorough

# 4 Maar we doen If the bone 8 2020/01/01 6:45 Typicalcat77

http://pedagognazaret.pl/%ef%bb%bfmature-dating-online-services-dating-online-sites/ america african mature dating online site http://caribbeanlake.com/seniors-newest-serious-relationship-dating-online-site-blogs.wankuma.com.pdf where to meet christian seniors in africa