In my application I have a class that is used to deserialize some response into objects. I have the Notification class and another class NotificationUnmarshaller. This has only one method:
 public IList<Noti开发者_JS百科fication> UnMarshal(PullResponse pullResponse)
I want to refactor this class into a public static method in Notification class. Something like:
public class Notification
{
    //members
    public static IList<Notification> FromResponse(PullResponse response}
    {
         //unmarshal
    }
}
In this a good design pattern? Is there any advantage of having a class with one single method to deserialize the response? Is the FromObject(...) method pattern a good one?
If all you are doing in this class is returning a deserialized object then I'd say no.
A generic template method works better for XML Serialization.
See: generic-xml-serializer-class
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论