Initializing object to handle null query results
I have an object model like this:

    public class MyObject{
      public int Prop1{get;set;}
      public int Prop2{get;set;}
    }

I use this object in a linq to sql query like this:

    var MyQuery = from....
                  where....
                  select new MyObject()
                    {
                      Prop1 = ...
                      Prop2 = ...
                    };

The problem is that sometimes Prop1 turns out empty in the query and I get an error because Prop1 is null.

I'm adding this to the class:

    public class MyObject{
    ...
    public void Init()
    {
      this.Prop1 = 0;
      this.Prop2 = 0;
    }

How do I link Init to the event "object just got created"?

And, is solving the problem of a null by initializing the object to 0 the best way to do it anyway?

Thanks for your suggestions.

Initializing object to handle null query results
===

I have an object model like this:

    public class MyObject{
      public int Prop1{get;set;}
      public int Prop2{get;set;}
    }

I use this object in a linq to sql query like this:

    var MyQuery = from....
                  where....
                  select new MyObject()
                    {
                      Prop1 = ...
                      Prop2 = ...
                    };

The problem is that sometimes Prop1 turns out empty in the query and I get an error because Prop1 is null.

I'm adding this to the class:

    public class MyObject{
    ...
    public void Init()
    {
      this.Prop1 = 0;
      this.Prop2 = 0;
    }

How do I link Init to the event "object just got created"?

And, is solving the problem of a null by initializing the object to 0 the best way to do it anyway?

Thanks for your suggestions.
