I ran across the following snippet of code. Names have been changed to protect the innocent:
public void RunProgram()
{
System.IO.FileInfo fInfo = new System.IO.FileInfo(Application.StartupPath + "Program.exe");
if (!fInfo.Exists)
{
System.Windows.Forms.MessageBox.Show("Program could not be found, please verify your insta...
In my C# code, I have an if statement that started innocently enough:
if((something == -1) && (somethingelse == -1) && (etc == -1)) {
// ...
}
It's growing. I think there must be 20 clauses in it now.
How should I be handling this?
...
What approaches do people take (if any) in managing guard clause explosion in your classes? For example:
public void SomeMethod<T>(string var1, IEnumerable<T> items, int count)
{
if (string.IsNullOrEmpty(var1))
{
throw new ArgumentNullException("var1");
}
if (items == null)
{
throw new ArgumentNullEx...
I'm trying to automate file comment headers. I'm stuck trying to figure out how to insert the result of the uuidgen command into my header using vim's autocmd.
Inside the header, the placeholder text is present, like this:
#ifndef _UUID_
#define _UUID_
// Code goes here!
#endif // _UUID_
The autocmd line to populate _UUID_ in .vimr...