System.Net.Mail.SmtpClient.SmtpResponse.Parse C# (CSharp) Method

Parse() public static method

public static Parse ( string line ) : SmtpResponse
line string
return SmtpResponse
			public static SmtpResponse Parse (string line) {
				SmtpResponse response = new SmtpResponse ();

				if (line.Length < 4)
					throw new SmtpException ("Response is to short " +
								 line.Length + ".");

				if ((line [3] != ' ') && (line [3] != '-'))
					throw new SmtpException ("Response format is wrong.(" +
								 line + ")");

				// parse the response code
				response.StatusCode = (SmtpStatusCode) Int32.Parse (line.Substring (0, 3));

				// set the raw response
				response.Description = line;

				return response;
			}
		}
SmtpClient.SmtpResponse