[Solved] How to make custom validation for all datatype in c# using extension methods [closed]


I think you do not know about variables in c#.

Please see more about variables in this link, because all types inherit from System.Object
enter link description here

For example, this code maybe solve your problem, but I don’t understand for what purpose…

public static class Test
{
    public static bool UserCheck(this object a)
    {
        return a != null;//ha-ha
    }
}

public class SomeProgramm
{
    public void main()
    {
        int a = 0;
        a.UserCheck();
        object b = new object();
        b.UserCheck();
    }
}

solved How to make custom validation for all datatype in c# using extension methods [closed]