如何在Mvc的模型类中为变量设置值? [英] How Do I Set Value To A Variable In Model Class Of Mvc?
本文介绍了如何在Mvc的模型类中为变量设置值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
public static class PathGenerator
{
public string Path{get{var path="SomeString";
return path;
};
set{};}
}
我不确定语法。我在这里尝试的是将值设置为声明的Path变量。请帮助。
I am not sure about the syntax. what i am trying here is to set value to the Path variable declared. Please help.
推荐答案
public static class PathGenerator
{
public string Path{
get{
return path;
};
set
{
var path="SomeString";
}
}
}
这篇关于如何在Mvc的模型类中为变量设置值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文