title: Can I put this in separate class?
body: <p>I have this repetitive piece of code:</p>
  
  <pre><code>var expCodes = (from cpdet in _dataContextOrders.CodeProfileDetails
                  join cpd in _dataContextOrders.CodeProfileDefinitions on cpdet.CodeProfileDefinitionID equals cpd.ID
                  join cp in _dataContextOrders.CodeProfiles on cpd.CodeProfileID equals cp.ID
                  join cc in _dataContextOrders.FMSCostCentres on cpdet.CostCentreID equals cc.ID
                  join ec in _dataContextOrders.FMSExpenseCodes on cpdet.ExpenseCodeID equals ec.ID
                  where cp.ID == Convert.ToInt32(intCostCodeProfileId)
                                    &amp;&amp; cpdet.CostCentreID == Convert.ToInt32(intCostCentreSelected)
                                    &amp;&amp; ec.Active == true
                  select new
                  {
                      ec.ID,
                      ec.CostCentreID,
                      ExpenseCodeExternalRef = ec.ExternalRef,
                      ExpenseCodeDescription = ec.Description,
                      displayExpenseCode = ec.ExternalRef + " " + ec.Description
                   }).Distinct().OrderBy(ec =&gt; ec.displayExpenseCode);
  
  ddlExpCode1.DataSource = expCodes;
  ddlExpCode1.DataTextField = "displayExpenseCode";
  ddlExpCode1.DataValueField = "ID";
  </code></pre>
  
  <p>What I would like to do is to put it into a Class on its own, as we did before LinqToSql, that I can call from my aspx.cs page, using the 2 parameters, intCostCodeProfileId and intCostCodeProfileId and it will return the data for the Drop Down List.</p>
  
  <p>How can I do this?</p>