Operator |
Description |
Example |
---|---|---|
. |
Dot. Used to distinguish objects and theirproperties and methods. |
var myUrl = Request.Url;var count =Request["Count"].AsInt(); |
() |
Parentheses. Used to group expressions and topass parameters to methods. |
@(3 + 7)@Request.MapPath(Request.FilePath); |
[] |
Brackets. Used for accessing values in arrays orcollections. |
var income =Request["AnnualIncome"]; |
= |
Assignment. Assigns the value on the right side of a statement to the object on the left side. (Noticethe distinction between the = operator and the == operator.) |
var age = 17; |
! |
Not. Reverses a true value to false and viceversa. Typically used as a shorthand way to testfor false (that is, for not true ). |
bool taskCompleted = false;// Processing.if(!taskCompleted) {// Continue processing} |
== |
Equality. Returns true if the values are equal. |
var myNum = 15;if (myNum == 15) {// Do something.} |
!= |
Inequality. Returns true if the values are notequal. |
var theNum = 13;if (theNum != 15) {// Do something.} |
< > <= >= |
Less-than,greater-than,less-than-or-equal, andgreater-than-or-equal. |
if (2 < 3) {// Do something.} var currentCount = 12; if(currentCount >= 12) {// Do something.} |
+ |
Math operators used in numerical expressions. |
@(5 + 13)@{ var netWorth = 150000; }@{ var newTotal = netWorth * 2; } |
ASP.NET is a development framework for building web pages and web sites with HTML, CSS, JavaScript and server scripting. ASP.NET supports three different development models: Web Pages, MVC (Model View Controller), and Web Forms.
Thursday, September 13, 2012
Operators inMVC
Subscribe to:
Post Comments (Atom)
Using Authorization with Swagger in ASP.NET Core
Create Solution like below LoginModel.cs using System.ComponentModel.DataAnnotations; namespace UsingAuthorizationWithSwagger.Models { ...
-
Output: using Microsoft.VisualBasic; using System; using System.Collections; using System.Collections.Generic; using S...
-
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.D...
-
<?xml version="1.0" encoding="utf-8"?> <Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting...
No comments:
Post a Comment