-1

I have a structure with a bunch of properties. All properties have a corresponding method called someMethod(). I am trying to call the method for each property that is in the struct. I need to be able to do this without anything except the struct. Is this even possible?

public class someStruct()
{
    public int prop1{get, set}
    public int prop2{get, set}
    public int prop3{get, set}
}

This obviously isn't my code, but gets the point across. Assume each prop has an add(). I could normally do:

someStruct example = new someStruct();
example.prop1.add();
example.prop2.add();
example.prop3.add();

But I need to have a method where I can pass in example and it will call add() for each property. End goal is to have a method called callAdds:

callAdds(example);
SQlBeginner
  • 65
  • 3
  • 9

1 Answers1

-1
try use
    //if this is the only format of date and time then you can use,
    Regex stringDatePattern=new Regex("*[0-9][0-9][/][0-9][0-9][/][0-9][0-9[0-9][0-9]]*");
    return stringDatePattern.IsMatch(TextBox.Text);
    //Split the string
    Regex.Split Method (String, String, RegexOptions);
  • 1
    I think you meant to post this on a different question. It has nothing to do with what is being asked. – Craig W. May 08 '15 at 20:06