net里面using的使用

起初using就明白一个作用  那就是引用命名空间。当面试官听到我回答这个问题的时候,马上就还问我,还有什么作用?我就只能摇头了,今天在网上看了下using的作用。

 

1.using指令。using + 命名空间名字 ,比如using System;

2.using别名。using + 别名 = 包括详细命名空间信息的具体的类型。

比如using System;
using aClass = NameSpace1.MyClass;
using bClass = NameSpace2.MyClass;

namespace NameSpace1 
{
    public class MyClass 
    {
        public override string ToString() 
        {
            return "You are in NameSpace1.MyClass";
        }
    }
}

namespace NameSpace2 
{
    class MyClass 
    {
        public override string ToString() 
        {
            return "You are in NameSpace2.MyClass";
        }
    }
}

namespace testUsing
{
    using NameSpace1;
    using NameSpace2;
    /// <summary>
    /// Class1 的摘要说明。
    /// </summary>
    class Class1
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
            //
            // TODO: 在此处添加代码以启动应用程序
            //
            
            aClass my1 = new aClass();            
            Console.WriteLine(my1);
            bClass my2 = new bClass();
            Console.WriteLine(my2);
            Console.WriteLine("Press any key");
            Console.Read();
        }
    }
}

3.using语句, 定义一个范围,在范围结束时处理对象

 

场景:
当在某个代码段中使用了类的实例,而希望无论因为什么原因,只要离开了这个代码段就自动调用这个类实例的Dispose。
要达到这样的目的,用try...catch来捕捉异常也是可以的,但用using也很方便。
例如:

 

using (Class1 cls1 = new Class1(), cls2 = new Class1())
{
  // the code using cls1, cls2


} // call the Dispose on cls1 and cls2

这里触发cls1和cls2的Dispose条件是到达using语句末尾或者中途引发了异常并且控制离开了语句块。

摘自http://www.cnblogs.com/windsails/archive/2004/09/12/42444.html

 

转载于:https://www.cnblogs.com/panjuan/p/4735845.html

Xfrog 3DS MAX PlugIn (07/04/2002) ======================================== Installation ------------------------------------------------- Copy the file xfrog.dlo into your plugins directory (e.g. c:\3dsmax42\plugins). Compatibility ------------------------------------------------- The PlugIn is compiled for discreet 3DS MAX 4.2+. It will not work with prior versions of 3DS MAX. Usage ------------------------------------------------- 1. Choose 'Import' from the 'File' Menu 2. Select 'Xfrog (*.XFR)' as File Import Filter and choose the Xfrog Model to import. Click OK. 4. The model and material should show up now. Feel free to modify the materials, changes made to the mesh itself will be overridden when the object is reevaluated. Options Panel ------------------------------------------------- The Animation Length Group lets you choose between the Animation Length preset in the file, a custom length to be specified, the length being scaled to fit the current animation length or to be ignored. For static models you should always change this setting to Ignore, this will prevent the model from being recreated when you move the frame slider. An existing Animation can be played back as a loop, swinging back and forth and only once. For faster redraws in viewport or for preview rendering you may also want to change the model quality in viewport and for rendering with the sliders at the bottom of the panel. If you need to access the geometry on a per component level you can do that by converting the object to an Editable Mesh, and choose Select By Material ID in Polygon Selection Mode. This will disable animation as the reference to the original Xfrog file is removed.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值