.Net Deck 6 Flashcards
How do you store Flags in an Enum?
[Flags]
public enum UserStatus: short
{
NotSet = 0,
[Description(“Inactive”)]
Inactive = 1,
[Description(“Active”)]
Active = 2
}
What are the first 4 numeric values of a Enum used to store Flags ?
0,1,2,4,8,16
How do you send email on the server?
You send it via SMTP
Simple Mail Transfer Protocol
What is the best was to concatenate strings in .Net and why?
There are 6 types of string concatenations:
Using the plus (+) symbol. Using string.Concat(). Using string.Join(). Using string.Format(). Using string.Append(). Using StringBuilder.
Write a C# function that accepts an array of integers, adds all the members and returns the result.
public int SumArr(int[] arr) { int sum = 0; foreach (int i in arr) { sum = sum + i; }
return sum; }
In an Api application, what information is used to route your request?
database proc
What protocol is normally used in a web request?
HTTP
What are the different types of HTTP methods? When would you use these over others?
POST| Create GET| Read PUT | Update/Replace PATCH | Update/Modify DELETE | Delete
What is attribute routing?
Routing is how Web API matches a URI to an action