We help IT Professionals succeed at work.
Get Started

remove repetitive code / pass property address into function

Ryan asked
Last Modified: 2012-08-22
I have the following code in a n-tier app, which is repeated about 40 times in my using a different function in DA.Components, and I'm wondering if there's a cleaner way to do it.  

NewECNs is populated within the function call, and is normally empty, and may eventually get up to a count of 10.

Dim NewECNs As New List(Of String)
lblTypeLabel.Text = DA.Components.GetArrTypeLabelPN(arrFamily, _EffectiveDate, NewECNs)
For Each s As String In NewECNs
	ECNs.Add(New ECN(s, "Type Label"))

Open in new window

My current thinking is if I could pass an address of the property ECN as list(of string), then I could remove all but the single function call, but I don't think I can do this? Any other ideas?
Watch Question
Project Engineer, Electrical
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE