Basics for the community
About sharing knowledge via code snippets
Lines of code is all about code snippets – that’s what it’s designed for. Although you don’t necessarily have to publish your code snippets in this community, this doesn’t meet the original purpose of linesOfCode. The aim is to impart knowledge about code snippets, to assist in the daily programming work and to broaden the users’ horizon.
However, this forces us to establish code snippets of good quality in order to create a vivid and smooth exchange of information and knowledge. Thus, I ask you to keep in mind the following three basic rules when making a contribution to linesOfCode.
Basic Rules
- (1) Ensure all code snippets you publish are working.
- (2) Inform about necessary libraries being used.
- (3) Write comments for main parts of your code snippet.
Snippet Example
'The following sample describes a method to
'read all text of a given file and assign
'it to a string variable.
'Necessary libraries
Imports My.Computer.FileSystem
...
Dim pathToFile as String = "C:\test.txt"
Dim fileContent as String = ""
'assign the whole file content to the variable fileContent
'using the ReadAllText() method
fileContent = ReadAllText(pathToFile, System.Text.Encoding.ASCII)
...