如何使用字符串类型参数创建类并返回 [英] How to create a class with string type parameter and return

查看:56
本文介绍了如何使用字符串类型参数创建类并返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何在asp.net类中创建字符串类型参数并返回类型?

How can I create string type parameter and return type also sting in my asp.net class?

推荐答案

尝试一下,
try this,
public static string MyClass(string param1)
{

//body of class

return param1;

}



希望对您有帮助,

如果有帮助,请投票5,


谢谢



hope it helps,

please vote 5 if it helps you,


thanks


您可以使用两个方法创建类:"setter"和"getter":前者可以写入字符串,后一个读取它的值.或者,您最好为此使用属性(请参见MSDN上的属性概述" [ ^ ]).
You may create a class with a pair of methods: ''setter'' and ''getter'' : the former to write the value of the string and the latter one to read the value of it. Or you may better use a property for this (see "Properties Overview" at MSDN[^]).


这篇关于如何使用字符串类型参数创建类并返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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