zoukankan      html  css  js  c++  java
  • 接口的使用

       好长时间没用了.今年看 petshop 都有点快忘了.....


       Account.cs
    using System;
    using System.Reflection;
    using System.Configuration;

    namespace Z_Petshop
    {
        
    /// <summary>
        
    /// Account 的摘要说明。
        
    /// </summary>

        public class Account
        
    {
            

                
    public int SignIn(string userId, string password) 
                
    {

                
                    
    if ((userId.Trim() == string.Empty) || (password.Trim() == string.Empty))
                        
    return 10;

                
                         
                        
                     IAccount dal
    =(IAccount)Assembly.Load("Z_Petshop").CreateInstance ("Z_Petshop."+"Class_Account");
                    
                    
                    
    int account = dal.SignIn(userId, password);

                
                    
    return account;
                }


             }


        
    }



    Class_Account.cs

    using System;

    namespace Z_Petshop
    {
        
    /// <summary>
        
    /// Class_Account 的摘要说明。
        
    /// </summary>

        public class Class_Account : IAccount
        
    {
            
    public int SignIn(string userId, string password) 
            
    {
               
                
    return 100 ;

            }




        }

    }


    IAccount.cs

    using System;

    namespace Z_Petshop
    {
        
    /// <summary>
        
    /// Iaccount 的摘要说明。
        
    /// </summary>

        public interface IAccount
        
    {
            
            
    int SignIn(string userId, string password);

            
        }

    }

    调用页面

     
    private void Page_Load(object sender, System.EventArgs e)
            
    {
                
    // 在此处放置用户代码以初始化页面
                  Account s=new Account ();
                
                
                
    int I=s.SignIn ("100","100");
                
    this.Response .Write (I);

            }
  • 相关阅读:
    迷你版jQuery——zepto核心源码分析
    zepto.js 源码解析
    zepto.js swipe实现触屏tab菜单
    zepto.js 处理Touch事件
    Zepto 使用中的一些注意点(转)
    判断js对象的数据类型,有没有一个最完美的方法?
    html 5 本地数据库(Web Sql Database)核心方法openDatabase、transaction、executeSql 详解
    HTML5本地存储——Web SQL Database
    js事件监听器用法实例详解-注册与注销监听封装
    10 个非常有用的 AngularJS 框架
  • 原文地址:https://www.cnblogs.com/gwazy/p/154135.html
Copyright © 2011-2022 走看看