本文介绍了访问属性内的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在asp.net安全中,当我们编写以下内容时:httpcontext.user.identity.isauthenticated()

这里的httpcontext是一个命名空间
用户是属性
身份是财产.
isauthenicated是一种方法...

我对"USER"和"IDENTITY"属性感到困惑...为什么我们可以在一个属性内访问属性?

In asp.net security, when we write : httpcontext.user.identity.isauthenticated()

here httpcontext is a namespace
user is a property
identity is a property.
isauthenicated is a method...

i am confused about ''USER'' and ''IDENTITY'' properties...how come we can access a property WITHIN A PROPERTY ???

推荐答案



BigBox myBigBox = new BigBox();
myBigBox.DrawerSeven.Box = new SmallBox(nameOfSmallBox);

然后您将以以下方式访问它的抽屉:

Then you would access it''s drawers as:

SmallBox mySmallBox = myBigBox.DrawerSeven.Box;
string s = mySmallBox.DrawerFour.Name;

您可以将这些结合起来并说:

You could combine these and say:

string s = myBigBox.DrawerSeven.Box.DrawerFour.Name;

并获得相同的结果.

Box是DrawerSeven的属性,而DrawerSeven是BigBox的属性.
名称是DrawerFour的属性,而DrawerFour是SmallBox的属性.

and get the same result.

Box is a property of DrawerSeven, which is a property of BigBox.
Name is a property of DrawerFour, which is a property of SmallBox.


这篇关于访问属性内的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 06:03