Almost ready to post next utility

by Jason Haley 13. November 2004 10:37

Today I finished up the code for another Resource File utility that I am going to (hopefully) post tomorrow. This utility is called ResourceWrapper. It will create a resource file wrapper class for you (give the resource file of course) in either VB.Net, C# or Managed C++. All the code templates are included so you can tweak the template to generate the class the way you want. Check out the syntax differences between the three languages, they pretty similiar when you take into account that the majority of the code is .Net FCL objects. Maybe I should do Cω too....or er uh maybe it would be the C# version?

VB.Net

  188         ' get an image

  189         Public Function GetImage(ByVal name As String) As Image

  190        

  191             If (_isLoaded = False) Then

  192                 Init()

  193             End If

  194            

  195             Return DirectCast(_resources.GetObject(name), Image)

  196         End Function

CSharp

   39         // get an image

   40         public Image GetImage(string name)

   41         {

   42             if (!_isLoaded )

   43                 Init();

   44            

   45             return (Image)_resources.GetObject(name);

   46         }

Managed C++

  128         // get an image

  129         Image* GetImage(String* name)

  130         {

  131             if (!_isLoaded )

  132                 Init();

  133            

  134             return (__try_cast<Image*>(_resources->GetObject(name)));

  135         }

Comments (0) | Post RSSRSS comment feed |

Categories:
Tags:

Comments are closed