Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

AnnCodecs class should be static
Started by Joshua at 08-29-2008 4:27. Topic has 2 replies.

Print Search « Previous Thread Next Thread »
  08-29-2008, 4:27
Joshua is not online. Last active: 12/16/2008 8:29:25 PM Joshua



Top 25 Posts
Joined on 03-12-2008
Munich, Germany
Posts 82
AnnCodecs class should be static
Reply Quote
The AnnCodecs class in LeadTools v15 .Net only has instance methods defined (i.e. you have to instantiate the object before you can call any methods on it).

The AnnCodecs class takes no constructor arguments, does not provide a Dispose() method (therefore, does not need to be disposed of), and does not have any methods which alter state data within the class. It is, as far as I can see, a helper class.

It would be great if you could turn this into a static class so that I don't have code like the following in my application:

using (MemoryStream annotationsStream = new MemoryStream())
{
    new AnnCodecs().Save(annotationsStream, m_annotationState, AnnCodecsFormat.Serialize, 1, AnnCodecsSavePageMode.Overwrite);
    DoSomethingWithAnnotationStream(annotationsStream);
}

Regards,

Josh.

   Report 
  08-29-2008, 14:28
GregR is not online. Last active: 1/2/2009 9:03:27 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,816
Re: AnnCodecs class should be static
Reply Quote
Good point =).  I have submitted a feature request regarding this functionality.  For your reference, the feature request number is 7262IDT.  If chosen for implementation, most feature requests are added at major releases (16, 17 etc.).

If this is an urgent need, please contact our custom development department by visiting http://www.leadtools.com/devservices/ for a quote.

If this isn't possible for some reason, the developers should give an explanation.  For now, I would suggest making a single global instance of the class and using it throughout your application so you don't have to use the constructor every time you use it.  It might save a little bit of processor time, and I doubt the AnnCodecs class will take up much memory.  Obviously, this is more of a simple programming style suggestion.

Greg Ross
LEADTOOLS Technical Support
   Report 
  12-05-2008, 13:34
GregR is not online. Last active: 1/2/2009 9:03:27 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,816
Re: AnnCodecs class should be static
Reply Quote
Our development team has decided not to implement this feature request at this time for 2 main reasons:

1. Even though there aren't any properties at this time, they may add some in the future.  Therefore, it was designed with the intent that if they do add some options to the AnnCodecs class, you could make multiple instances of it and only have to change the properties once rather than flip-flopping back and forth.

2. If we were to make this change mid-release, it would break backwards compatibility so if anyone were to download a patch, their code would no longer work.  We try to only make code-usage changes on major releases.

Greg Ross
LEADTOOLS Technical Support
   Report 
Post
LEAD Support Fo... » General » Feature Request... » AnnCodecs class should be static

Powered by Community Server, by Telligent Systems