I'm trying to retain the selected value of a dropdownlist once the user change the dropdownlist item but its not working as expected what I wanted is to retain the selected item in the dropdownlist but its it defaulted to the `Select Company` everytime i select the item from dropdownlist, once the user change it postback the page (i know there is no postback in the MVC)

What I'm doing wrong here?

```
<div class="form-group">
   @using (Html.BeginForm("Index", "Home", FormMethod.Post, new { @id = "form_dropdown" }))
   {
      @Html.DropDownListFor(m => m.ListOfCompanies, 
      new SelectList((System.Collections.IEnumerable)Model.ListOfCompanies, "Value", "Text"), 
      "Select Company", new { @class = "form-control", Name = "sel" })
  } 

```

```
[HttpPost]
public ActionResult Index(string sel)
{
   var vModel = new EmployeeViewModel();
   vModel = _db.GetEmployee.ToList();

   //load list of companies:

   var company =   _db.LoadComapny.ToList();          
   IEnumerable<SelectListItem> result = model.Select(b => new SelectListItem
   {
       Value = b.Value,
       Text = b.Text,
       Selected = b.Text == sel
   }).ToList(); 

   vModel.ListOfCompanies = company;
   vModel.SELECTED_COMPANY = sel;

   return View(vModel);
}

```

Model:

```
public class EmployeeViewModel
{
   public IEnumerable<SelectListItem> ListOfCompanies { get; set; }
   public string SELECTED_COMPANY { get; set; }
   //other props
}

```
['https://Stackoverflow.com/questions/31441040', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/275390/']
`object B` doesn't really have much to do with `class B` aside from some special rules.

If you wish to reuse that `doSomething` method you should just reuse the implementation from the object:

```
class B {
  def doSomething() = B.doSomething()
}

```

If you want to specify `object B` as a specific instance of `class B` then you should do the following:

```
object B extends B("some particular creator") {
...
}

```

You also do not need `override` modifiers although they can be handy for compiler checks.
The notion of a *companion object* extending a trait is useful for defining behavior associated with the class itself (e.g. static methods) as opposed to instances of the class. In other words, it allows your static methods to implement interfaces. Here's an example:

```
import java.nio.ByteBuffer

// a trait to be implemented by the companion object of a class
// to convey the fixed size of any instance of that class
trait Sized { def size: Int }

// create a buffer based on the size information provided by the
// companion object
def createBuffer(sized: Sized): ByteBuffer = ByteBuffer.allocate(sized.size)

class MyClass(x: Long) {
  def writeTo(buffer: ByteBuffer) { buffer.putLong(x) }
}
object MyClass extends Sized {
  def size = java.lang.Long.SIZE / java.lang.Byte.SIZE
}

// create a buffer with correct sizing for MyClass whose companion
// object implements Sized. Note that we don't need an instance
// of MyClass to obtain sizing information.
val buf = createBuffer(MyClass)

// write an instance of MyClass to the buffer.
val c = new MyClass(42)
c.writeTo(buf)

```