Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

Max length of code snippet?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Clive Dixon - 11 Mar 2008 17:22 GMT
Is there a maximum length for a code snippet? I have created quite a long
one (> 170 lines), which when I use it to generate code, it only generates
around the first 170 lines of the snippet.
Jon Skeet [C# MVP] - 11 Mar 2008 17:33 GMT
> Is there a maximum length for a code snippet? I have created quite a long
> one (> 170 lines), which when I use it to generate code, it only generates
> around the first 170 lines of the snippet.

Do you really have over 170 lines of code which you need to include
verbatim on a regular basis? I'd get really worried if I started seeing
that much code in multiple places.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk

Clive Dixon - 11 Mar 2008 18:51 GMT
Well yes, so would I, but I am having to deal with badly designed legacy
code - my attempts to refactor by 'genericising' can unfortunately only go
so far and there are still large areas where it's frankly easiest to plonk a
large code snippet in when creating a new class for a certain purpose in the
system. Thus far we've had to create by hand... (The classes use an
underlying corresponding set of auto-generated classes which severely limits
the amount of generic code which can be created, and it's far far too risky
to do anything to change that autogenerated code right now, believe me. I
wish I could, but I have to work with what I've got.)

Anyway, found my problem: I had a double $ in the code snippet where there
was a replacement token, which stopped the snippet generation in its tracks.

>> Is there a maximum length for a code snippet? I have created quite a long
>> one (> 170 lines), which when I use it to generate code, it only
[quoted text clipped - 4 lines]
> verbatim on a regular basis? I'd get really worried if I started seeing
> that much code in multiple places.
Jon Skeet [C# MVP] - 11 Mar 2008 19:05 GMT
> Well yes, so would I, but I am having to deal with badly designed legacy
> code - my attempts to refactor by 'genericising' can unfortunately only go
[quoted text clipped - 9 lines]
> was a replacement token, which stopped the snippet generation in its
> tracks.

Ah, right. Wow, that does sound like a grim situation :(

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.