Hi,
First of all you should not declare int x6, string x4 separate variables instead you should create a class including all the required attributes as properties and then create the object of the class inside logical piece of code
if you are using c# code behind the best way is to put your logical piece of code inside Using clause. secondly you can implement the Idisposable interface in the class where you have return the logic
example given below
you variables as class
public class clsEmail
{
public string EmailFrom
{
get { return _EmailFrom; }
set { _EmailFrom = value; }
}
public string EmailTo
{
get { return _emailTo; }
set { _emailTo = value; }
}
public string Emailcc
{
get { return _emailcc; }
set { _emailcc = value; }
}
public string EmailSub
{
get { return _EmailSub; }
set { _EmailSub = value; }
}
public string Emailbody
{
get { return _Emailbody; }
set { _Emailbody = value; }
}
}
using (someEntities objDataContext = new someEntities())
{
clsEmail obj=new clsEmail();
class1 objclass=new Class1
inboxId = (from inbox in objTWEYPSDataContext.tblInboxItems
where inbox.RequestId == RequestId && inbox.StartedBy == startedBy && inbox.State == actionState
select inbox.InboxId).SingleOrDefault();
return inboxId;
}
Once you come out of the above logical code all the objects like objDataContext, objclass and obj/pre> etc will be destroyed
Thanks and regards
Murtuza