Click here to Skip to main content
15,902,198 members
Home / Discussions / C#
   

C#

 
AnswerRe: Philisophical question [modified] Pin
Douglas Troy15-Jan-09 5:03
Douglas Troy15-Jan-09 5:03 
GeneralRe: Philisophical question Pin
S. Senthil Kumar16-Jan-09 4:32
S. Senthil Kumar16-Jan-09 4:32 
AnswerRe: Philisophical question Pin
#realJSOP15-Jan-09 5:50
professional#realJSOP15-Jan-09 5:50 
AnswerRe: Philisophical question Pin
Scott Dorman15-Jan-09 5:51
professionalScott Dorman15-Jan-09 5:51 
GeneralRe: Philisophical question Pin
carbon_golem15-Jan-09 8:34
carbon_golem15-Jan-09 8:34 
GeneralRe: Philisophical question Pin
Scott Dorman15-Jan-09 8:39
professionalScott Dorman15-Jan-09 8:39 
GeneralRe: Philisophical question Pin
S. Senthil Kumar15-Jan-09 18:28
S. Senthil Kumar15-Jan-09 18:28 
GeneralRe: Philisophical question Pin
carbon_golem16-Jan-09 5:51
carbon_golem16-Jan-09 5:51 
No. If you chain constructors, the compiler is smart enough to put members initialized in the class body into the last chain target. I went back through and verified this. Here is some sample code for you to compile and run ILDasm on. Car has chained constructors, where Truck does not. Truck's constructors all get the initialization code for the CultureInfo member, where Car has the initialization for CultureInfo in the constructor that takes 2 args.

using System;
using System.Globalization;

namespace ConstructorChainKata {
    class Program {
        static void Main(string[] args) {
        }
    }

    public enum Market {
        Production,
        Concept,
        Military,
        Custom,
        Armored
    }

    public class Car {
        private String manufacturer;
        private Market market;
        private CultureInfo targetLocale = new CultureInfo("en-US");

        public Car(String manuf) :this(manuf, Market.Production) {
            //..
        }
        public Car(String manuf, Market markt) {
            manufacturer = manuf;
            market = markt;
        }
    }


    public class Truck {
        private String manufacturer;
        private Market market;
        private CultureInfo targetLocale = new CultureInfo("en-US");

        public Truck(String manuf) {
            manufacturer = manuf;
            market = Market.Production;
        }
        public Truck(String manuf, Market markt) {
            manufacturer = manuf;
            market = markt;
        }
    }
}


Scott P

"Simplicity carried to the extreme becomes elegance."
-Jon Franklin

GeneralRe: Philisophical question Pin
S. Senthil Kumar16-Jan-09 6:58
S. Senthil Kumar16-Jan-09 6:58 
GeneralRe: Philisophical question Pin
Gary Wheeler16-Jan-09 0:41
Gary Wheeler16-Jan-09 0:41 
GeneralRe: Philisophical question Pin
Scott Dorman16-Jan-09 3:41
professionalScott Dorman16-Jan-09 3:41 
AnswerRe: Philisophical question Pin
S. Senthil Kumar15-Jan-09 18:39
S. Senthil Kumar15-Jan-09 18:39 
AnswerRe: Philisophical question Pin
Vikram A Punathambekar15-Jan-09 22:03
Vikram A Punathambekar15-Jan-09 22:03 
GeneralRe: Philisophical question Pin
Gary Wheeler16-Jan-09 0:39
Gary Wheeler16-Jan-09 0:39 
GeneralRe: Philisophical question Pin
Vikram A Punathambekar16-Jan-09 1:47
Vikram A Punathambekar16-Jan-09 1:47 
GeneralRe: Philisophical question Pin
Gary Wheeler16-Jan-09 1:52
Gary Wheeler16-Jan-09 1:52 
QuestionSybase Binary Columns [modified] Pin
mobius11100115-Jan-09 4:25
mobius11100115-Jan-09 4:25 
AnswerRe: Sybase Binary Columns [modified] Pin
Dave Kreskowiak15-Jan-09 4:49
mveDave Kreskowiak15-Jan-09 4:49 
GeneralRe: Sybase Binary Columns Pin
mobius11100115-Jan-09 10:09
mobius11100115-Jan-09 10:09 
GeneralRe: Sybase Binary Columns Pin
Dave Kreskowiak15-Jan-09 10:40
mveDave Kreskowiak15-Jan-09 10:40 
GeneralRe: Sybase Binary Columns Pin
mobius11100116-Jan-09 2:50
mobius11100116-Jan-09 2:50 
GeneralRe: Sybase Binary Columns Pin
Dave Kreskowiak16-Jan-09 11:36
mveDave Kreskowiak16-Jan-09 11:36 
GeneralRe: Sybase Binary Columns Pin
mobius11100121-Jan-09 5:37
mobius11100121-Jan-09 5:37 
QuestionHow to import data from rtf file to datatable Pin
srinivasadithya15-Jan-09 4:11
srinivasadithya15-Jan-09 4:11 
AnswerRe: How to import data from rtf file to datatable Pin
Jani Giannoudis15-Jan-09 12:56
mvaJani Giannoudis15-Jan-09 12:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.