在同一解决方案中的另一个项目的类文件中的codebehindfile中指定的访问属性 [英] Access property specified in codebehindfile in class file in another project in same solution

查看:49
本文介绍了在同一解决方案中的另一个项目的类文件中的codebehindfile中指定的访问属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我有一个属性,它将会话值存储在.cs文件中。

我想在同一个解决方案但不同项目的另一个类文件中访问该属性。



例如:


在.cs文件中的
我将会话值保存为:

Hi I have a property which stores session value in .cs file .
I want to access that property in another class file in same solution but different project.

eg:

in .cs file i am saving session value as :

public Int16 Year
{
   get
   {
       if session(year) == null)
         new Int16());
       return Convert.ToInt16(session(year));
   }
   set
   {
      session(year)  , value);
   }
}



我想在同一解决方案中的不同项目中的另一个类文件中访问此属性。



我尝试过:



i尝试过pagename.propertyname。我应该尝试什么


I want to access this property in another class file in different project in same solution.

What I have tried:

i tried pagename.propertyname . what shoul i try

推荐答案

YourNamespace.YourClass x = new YourNamespace.YourClass();
Int16 year = x.Year;





你必须使用正确的命名空间和类名,项目将需要引用该类所在的项目。



You'll have to use the correct namespace and classname, and the project will need a reference to the project that the class is in.


这篇关于在同一解决方案中的另一个项目的类文件中的codebehindfile中指定的访问属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆