Effect.CurrentTechnique Property

Gets or sets the active technique.

Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

public EffectTechnique CurrentTechnique { get; set; }

Property Value

The current technique.

Exception typeCondition

CurrentTechnique is null. CurrentTechnique cannot be null.

The BasicEffect class, which is derived from Effect and inherits the Techniques collection, contains only one available technique to set as the active technique. The active technique applies the settings that have been set as the properties of the BasicEffect.

In this example, an effect file is shown that defines a single technique called TransformTechnique.
uniform extern float4x4 WorldViewProj : WORLDVIEWPROJECTION;

struct VS_OUTPUT
    float4 position : POSITION;
    float4 color : COLOR0;

VS_OUTPUT Transform(
    float4 Pos  : POSITION, 
    float4 Color : COLOR0 )

    Out.position = mul(Pos, WorldViewProj);
    Out.color = Color;

    return Out;

float4 PixelShader( VS_OUTPUT vsout ) : COLOR
    return vsout.color;

technique TransformTechnique
    pass P0
        vertexShader = compile vs_2_0 Transform();
        pixelShader = compile ps_1_1 PixelShader();
When this effect file is loaded as an Effect by the ContentManager, this technique may be set as the active technique by setting CurrentTechnique to effect.Techniques["TransformTechnique"].

Xbox 360, Windows XP SP2, Windows Vista