简体   繁体   中英

access a value returned by partial class

I am Working in asp.net and c#.

I have a partial class in my application.One of the methods of this class returns a value( value is a dataset ) like return value;

example code:

      public partial class CommonClass : IDisposable
      {
        public static dataset somemethod(string somevariable)
          {

             //some code


             return variable;

          }


      }

Now i want to access the value of variable in my codebehind.How can i do that.please give some sugessions..

NOTE :variable is a dataset..

就像这样您可以做到,因为方法是静态的,因此无需创建任何类的实例,您可以按以下方式调用它

DataSet  ds =CommonClass.somemethod("mydata") ;

You can call the static method somemethod of your class CommonClass . You can read more about static and instance methods here .

DataSet ds = CommonClass.somemethod("somevalue");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM