I have a "Literal" class that defines a text value and an ID. I want to build a static method that is simply "FromValue(string)" within the Literal class (LINQ to SQL), so that it'll return the proper Literal instance from a given value.
I'm having some trouble figuring out how to do this, though. I mean, I can call it in code everytime I need it, but it would be much more convenient and time saving to just wrap it into the class itself.
Any ideas?
using System;
using System.Linq;
namespace Context
{
public partial class Literal
{
public static Literal FromValue(string value)
{
// linq code, how do I reference the existing data context?
return null;
}
}
}