Solved

constructory tips and tricks

Posted on 2004-08-09
1
227 Views
Last Modified: 2010-04-15
Say i Have 4 constructors in the same class,  all of them have different parms (of course)

but they all have to call the same setUp method called tis._setPropertyInfo

Is there a way to kind of build on the work that is being done by one constructor to do the next?

so that I can just call or use the base Constructor each time?
0
Comment
Question by:jayrod
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 4

Accepted Solution

by:
NTAC earned 500 total points
ID: 11756816
If they are all calling the same setup method--just place the common code in that method.  

If you want--you can call one constructor from another like this:

public class Class1
{
   private string s;

    public Class1(): this("Hello")
    {

    }

    publicClass1(string test)
    {
        s = test;

    }
}

This link gives more info, as well as the C# documentation
http://www.codeproject.com/dotnet/ConstructorsInCSharp.asp
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ado.net AddWithValue when using IN condition 7 45
ASP.NET MVC -Update model when click on <li> element 29 103
Header Font Size in Grid View 6 50
asp.net, radiobuttonlist, c# 3 69
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question