|
On 6/16/05, Joe Pluta <joepluta@xxxxxxxxxxxxxxxxx> wrote: > > From: Steve Richter > > > > CLI ( common language infrastructure ) is the .NET value add that no > > other platforms have. It is a specification that all .NET languages > > adhere to which enables class code written in one language to be > > referenced from an assembly and used in the code of another language. > > CLI and assemblies are what make it possible for a function written > > in C++ to be used in a java program. > > My big objection to this phrase is the fact that, while OS/400 has no > explicit CLI, you have been able to do inter-program calls for decades, > with bidirectional parameters, no less. > > My problem is that CLI is that from what I've seen it's all class-based. > Only languages that adhere to a strict class-based syntax can play. > That's a pretty serious limitation, since not all code needs classes. > In fact, as we've shown over the years, quite a bit of really excellent > code can be written without classes. Joe, I had the same reaction. "static" methods are the equivalent of standalone procedures. The .NET Convert class is a good example of a static class. http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemConvertClassTopic.asp?frame=true To convert a string to an integer: int PortNx ; string PortNumber = "23" ; PortNx = System.Convert.ToInt32( PortNumber ) ; this static method converts a base64 encoded string to an array of bytes: byte[] results = System.Convert.FromBase64String( ResponseData ) ; The DateTime class has a bunch of good static methods: DateTime beginRun = DateTime.Now ; // the current timestamp DateTime endRun = DateTime.UtcNow ; // the current UTC timestamp. The advantage of static class methods over standalone procedures is you can make your statics either public or private. You organize the statics in a class ( really a namespace ). Users of your class only see the public methods. To structure your code you have a bunch of private static methods that do a lot of the work, only users of the class dont have to see those methods. -Steve
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.