I know this could be a simple question, but I was thinking in C # that the incoming string would parse What is the best way to do this method set for an integer example if I have public int foo {get; On the set I want to parse the incoming string on the set
There are many ways of this cat to skin how can I do this.
Say your property is:
Public ent fu {get {return _foo; } Set {_foo = value; }}
You can do that adding helpful methods to your class:
Public Zero SetFoo (string sfu) {Foo = Convert.ToInt32 ( SFoo)); }
Then, when you have to set the value using a string, you can call that method:
myFooObject.SetFoo ( "4");
No comments:
Post a Comment