Hi Friends,
Today, i would like to introduce one quick and very useful technique to generate a new type. Basically, Types here am referring for classes. Many a time, when you are coding, you need to feed data to some service, so rather passing the same as individual parameters, we usually prefer via model.
Let me give a brief demo on the same. Now, below am accepting few parameters from the webpage in old school style.
Now, rather doing this, we can wrap the same in one class and then expose the same. So, here i’ll use the re-factoring technique to create my class as shown below.
Then, specify the parameters as shown below
Now, in that class you can go ahead and specify these properties as shown below.
So, now when you run and check, it will produce the same thing but in a more structured pattern.
That’s it for now. Till then stay tuned and happy coding.
Thanks,
Rahul